Detect if player is facing a certain block

  • 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 community!

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

PixelCraft_I_D_K

Active Member
Jul 18, 2023
66
1
8
Hi there! I need some assistance with detecting if a player is facing a certain block.
Here is my code.

Code:
on right click:
    if player is holding white dye named "&f&lDoor Open":
        if player is facing iron door:
            make player execute command "thru"
        else:
            send "&cYou have to be facing a door to go through it!" to player

There is an error with "If player is facing iron door."
How can I make it so I can make a player execute a command only when facing an iron door? All replies are thanked :emoji_grinning:
 
You can check the player's target block.
Code:
if player's target block is iron door
OR...
you can check the clicked block
Code:
if clicked block is iron door