Teleport not teleporting to the right 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 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!

Glixed

Member
Jul 26, 2024
1
0
1
As the title suggests, my teleport code is not working. There's no errors, it's just teleporting me in the wrong direction.
once i right click on a nether star, it runs this code:
Code:
(other stuff)           
            set {_posX} to player's x-position
            set {_posY} to player's y-position
            set {_posZ} to player's z-position
            if player's facing is north:
                set {warp} to location ({_posX}, ({_posY} + 1), ({_posZ} - 10))
                set yaw of {warp} to 180
                teleport player to {warp}
                play sound "entity.enderman.teleport" at volume 3 to entities in radius 20 of player
            if player's facing is east:
                set {warp} to location (({_posX} + 10), ({_posY} + 1), {_posZ})
                set yaw of {warp} to -90
                teleport player to {warp}
                play sound "entity.enderman.teleport" at volume 3 to entities in radius 20 of player
            if player's facing is south:
                set {warp} to location ({_posX}, ({_posY} + 1), ({_posZ} + 10))
                set yaw of {warp} to 0
                teleport player to {warp}
                play sound "entity.enderman.teleport" at volume 3 to entities in radius 20 of player
            if player's facing is west:
                set {warp} to location (({_posX} - 10), ({_posY} + 1), {_posZ})
                set yaw of {warp} to 90
                teleport player to {warp}
                play sound "entity.enderman.teleport" at volume 3 to entities in radius 20 of player
            if player's pitch is -90:
                set {warp} to location (({_posX}), ({_posY} + 9), {_posZ})
                set pitch of {warp} to -90
                teleport player to {warp}
                play sound "entity.enderman.teleport" at volume 3 to entities in radius 20 of player
            if player's pitch is 90:
                set {warp} to location (({_posX}), ({_posY} - 9), {_posZ})
                set pitch of {warp} to 90
                teleport player to {warp}
                play sound "entity.enderman.teleport" at volume 3 to entities in radius 20 of player
            if 20 is less than player's yaw:
                if player's yaw is less than 60:
                    set {warp} to location (({_posX} - 8), ({_posY} + 1), ({_posZ} + 8))
                    set yaw of {warp} to 45
                    teleport player to {warp}
                    stop
            if -160 is less than player's yaw:
                if player's yaw is more than -100:
                    set {warp} to location (({_posX} + 8), ({_posY} + 1), ({_posZ} - 8))
                    set yaw of {warp} to -145
                    teleport player to {warp}
                    stop
            if player's yaw is greater than 120:
                if player's yaw is less than 160:
                    set {warp} to location (({_posX}) - 8, ({_posY}), ({_posZ}) - 8)
                    set yaw of {warp} to 145
                    teleport player to {warp}
                    stop
            if -60 is less than player's yaw:
                if player's yaw is greater than -20:
                    set {warp} to location (({_posX} + 8), ({_posY}), ({_posZ} + 8))
                    set yaw of {warp} to -45
                    teleport player to {warp}
                    stop
so if anyone knows how to fix this, please let me know!