Solved Help Request: Determining Player's Facing Direction

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

  • LOOKING FOR A VERSION OF SKRIPT?

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

Matthew087168

Member
Aug 12, 2024
3
0
1
24
Hi everyone,

I'm working on a script and I need help to make it correctly detect the direction the player is facing. Could you provide some guidance on how to achieve this? Also, here is the current version of the script I’m using:

Code:
# Configurazione delle opzioni
options:
    item1: Netherite Sword
    item2: Golden Apple
    item3: Iron Chestplate
    item4: Nether Star
    menuText: &eMenu RPG

# Comando per aprire il menu
command /menu:
    trigger:
        if {menu.%player%} is true:
            delete {menu.%player%}
            delete holo object "%player%.menu"
            stop
        
        else:
            set {menu.%player%} to true
            set {_loc} to location of player
            add 2 to y-coordinate of {_loc}

            create holo object "ItemStack:{@item1};{@menuText}" with id "%player%.menu" at {_loc}
            set {menuItems::1} to {@item1}
            set {menuItems::2} to {@item2}
            set {menuItems::3} to {@item3}
            set {menuItems::4} to {@item4}
            set {currentMenuIndex.%player%} to 1

# Gestione dei clic del giocatore
on rightclick:
    if {menu.%player%} is true:
        add 1 to {currentMenuIndex.%player%}
        if {currentMenuIndex.%player%} is greater than 4:
            set {currentMenuIndex.%player%} to 1
        set {_item} to {menuItems::%{currentMenuIndex.%player%}%}
        delete holo object "%player%.menu"
        set {_loc} to location of player
        add 2 to y-coordinate of {_loc}
        create holo object "ItemStack:%{_item}%;{@menuText}" with id "%player%.menu" at {_loc}

on leftclick:
    if {menu.%player%} is true:
        remove 1 from {currentMenuIndex.%player%}
        if {currentMenuIndex.%player%} is less than 1:
            set {currentMenuIndex.%player%} to 4
        set {_item} to {menuItems::%{currentMenuIndex.%player%}%}
        delete holo object "%player%.menu"
        set {_loc} to location of player
        add 2 to y-coordinate of {_loc}
        create holo object "ItemStack:%{_item}%;{@menuText}" with id "%player%.menu" at {_loc}

# Pulizia dopo 30 secondi
every 30 seconds:
    loop all players:
        if {menu.%loop-player%} is true:
            delete {menu.%loop-player%}
            delete holo object "%loop-player%.menu"
 
Hello!

You can use:

code_language.skript:
direction of player
Okay, thank you very much for the information. The only thing is that I'm not sure how to integrate it or where to place it within the code. Could you please help me with that? Thanks again for the previous response
 
I finally solved it! for those who need it I leave my solution here, thanks again to everyone
 

Attachments

  • message.txt
    3.9 KB · Views: 12