Skript Help :pray:

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

PoopsFart

Member
May 4, 2024
1
0
1
21
I'm working on a skript which can teleport the player or another player (whom they hit) to a location of an arrow that the player shot
I don't get any errors but it doesn't work :emoji_pensive:
Does anyone know why or can help me :emoji_pray:

Code:
on shoot:

    if shooter is a player:

        if projectile is an arrow:

            if shooter's tool is bow:

                if display name of shooter's tool is "&dVoid Bow":

                    set {TeleportArrow} to true

                    set {ArrowID} to 1

                    set shooter's held item to {VoidPortal}

on projectile collide:

    if event-projectile is an arrow:

        if {ArrowID} is set:

            set {_Location} to event-projectile

            set {StoredLoc} to {_Location}

on right click:

    if player's held item is a diamond named "&dVoid Portal":

        set {_tp} to uuid of player

        if {Mana::%{_tp}%} is more than 25:

            remove 25 from {Mana::%{_tp}%}

            teleport player to {StoredLoc}

            wait 1 second

            delete {StoredLoc}

            delete {ArrowID}

        else:

            stop

on damage of player:

    if attacker's held item is a diamond named "&dVoid Portal":

        set {_attacker} to uuid of attacker

        if {Mana::%{_attacker}%} is more than 10:

            remove 10 from {Mana::%{_attacker}%}

            teleport victim to {StoredLoc}

            wait 1 second

            delete {StoredLoc}

            delete {ArrowID}

        else:

            stop

Also im new to the forums so sorry if i do anything wrong :sob:
 
I rewrote with metadatas for storage and should fix variable overwrites

AppleScript:
on shoot:

    if shooter is a player:

        if projectile is an arrow:

            if shooter's tool is bow:

                if display name of shooter's tool is "&dVoid Bow":

                    set shooter's held item to {VoidPortal}

                    set metadata tag "VoidOwner" of projectile to shooter

on projectile collide:

    if event-projectile is an arrow:

        if metadata tag "VoidOwner" of event-projectile is set:

            set {_p} to metadata tag "VoidOwner" of event-projectile

            set metadata tag "VoidLoc" of {_p} to location of event-projectile

            clear metadata value "VoidOwner" of event-projectile
    
on right click:

    if player's held item is a diamond named "&dVoid Portal":

        metadata tag "VoidLoc" of player is set

        set {_tp} to uuid of player

        if {Mana::%{_tp}%} is more than 25:

            remove 25 from {Mana::%{_tp}%}

            teleport player to metadata tag "VoidLoc" of player

            wait 1 second

            clear metadata value "VoidLoc" of player

        else:

            stop

on damage of player:

    if attacker's held item is a diamond named "&dVoid Portal":

        set {_attacker} to uuid of attacker

        if {Mana::%{_attacker}%} is more than 10:

            remove 10 from {Mana::%{_attacker}%}

            teleport victim to metadata tag "VoidLoc" of attacker

            wait 1 second

            clear metadata value "VoidLoc" of attacker

        else:

            stop