What's wrong here?

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

Twooze

Member
Aug 13, 2018
4
0
0
25
Quick and basic intro - I'm creating a skript to create a pet name "Orbix" that follows you around, but I can't get the command to remove the pet to work. It simply doesn't do anything. Here's my code:

Code:
command /orbixon:
    trigger:
        spawn an armor stand at location behind the player
        set {_orb.%player%} to spawned armor stand
        add "{CustomNameVisible:1,NoGravity:4b,Small:1,Invisible:1,Invulnerable:1,NoBasePlate:1,DisabledSlots:2039583}" to nbt of {_orb.%player%}
        set name of spawned armor stand to "&7%player%&7's &b&lOrbix"
        set {_head} to "Variable" parsed as offlineplayer
        set helmet of spawned armor stand to skull of {_head}
        while {_orb.%player%} is alive:
            if distance between player and {_orb.%player%} is greater than 1:
                teleport {_orb.%player%} behind the player
            wait a tick

command /orbixoff:
    trigger:
        delete {_orb.%player%}
        send " "
        send "&7&oOrbix transfers his essence into your body as he dissapears..." to player
        send " "
 
Use the help forum, this forum is called the request forum, for requesting people to write scripts for you.
[doublepost=1560321509,1560311887][/doublepost]Also to answer your question you have a few issues
1) You are using a local variable, which is local to the event it was initiated in, meaning you can access it in another event/trigger (your command to turn it off)
2) `delete {_orb.%player%}` <-- once you fix the local variable issue, this code here will just delete the variable itself, not what the variable holds, you might want to try `kill {var}`