Problem with checking items in inventory

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

otak

Member
Oct 10, 2022
4
0
1
24
Hello, I need help
the script checks the player head without a name because the script my command "player head named "&b&lTeleporthome" is ignored.

but I'm facing the problem that if the player has a player head without a name in the inventory, nothing happens and it doesn't even send the message "&3&l[HOME] &cYou don't have a Teleporthome." can it be fixed somehow?

Code:
command /home:
    executable by: players
    trigger:
        if {homes%uuid of player%} is not set:
            message "&3&l[HOME] &bYou have no set home!"

        else if player has an player head:
            loop all items in player's inventory:
                name of loop-value is "&b&lTeleporthome"
                message "&3&l[HOME] &bYou will be teleported in 3 seconds"
                wait 60 ticks
                teleport player to {homes%uuid of player%}
                remove 1 of loop-value from player
                send "&3&l[HOME] &bYou were teleported home and the teleport was destroyed." to player
                play sound "entity.enderman.teleport" at player
                stop
        else:
            send "&3&l[HOME] &cYou don't have a Teleporthome." to player
 
Use ::%player’s uuid in variables
Remove the last else:
I'm not sure how to use it and is a UUID variable required or will a temporary ::%player% suffice

I removed the else:
and it already works as it should, even the player head without a name doesn't mind
How is it possible. I don't understand how it works?
 
I'm not sure how to use it and is a UUID variable required or will a temporary ::%player% suffice

I removed the else:
and it already works as it should, even the player head without a name doesn't mind
How is it possible. I don't understand how it works?
A ::%player% would change if the player changes their name, an uuid never changes