1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do you detect if a player is in a certain distance of a block?

Discussion in 'Skript' started by Cozmicweb, Apr 5, 2021.

Thread Status:
Not open for further replies.
  1. Cozmicweb

    Cozmicweb Member

    Joined:
    Apr 5, 2021
    Messages:
    3
    Likes Received:
    0
    I have looked everywhere and can't figure out how to if a player is in a certain distance of a block. Can anyone help me?
     
  2. Mattia

    Mattia Member

    Joined:
    Apr 4, 2021
    Messages:
    29
    Likes Received:
    1
    Code (Text):
    1. on place of iron block:
    2.  set {block.loc} to location of block
    3.  
    4. command /distance:
    5.  trigger:
    6.   set {_distance} to distance between player and {block.loc}
    7.   send "You are %{_distance}% blocks distant from the iron block you placed"  send "You are %{_distance}% blocks distant from the iron block you placed"
    Haven't tested it in-game but it doesn't give errors in the parser
     
Thread Status:
Not open for further replies.

Share This Page

Loading...