Teleport player to another player's coordinates

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

Status
Not open for further replies.

Blep

New Member
Jun 23, 2020
9
0
1
25
I can't find a solution to this but I know I'm not the first person to run into this issue, so sorry if this has already been answered, but how do I teleport a player to another player's coordinates. Sounds confusing, but I'm not trying to teleport a player to another player, but rather their coordinates. Maybe you'll understand if you see my code


Code:
command /spectate [<player>]:
    aliases: /spec, /spectator
    trigger:
        if arg-1 is set:
            set player's gamemode to spectator
            set {_player} to "%arg-1%"
            broadcast "%{_player}%"
            set {_coords} to the location of {_player}
            teleport player to {_coords} in world ul_Ocean

Sorry if that was confusing. Heres the skript error
upload_2020-12-9_20-16-26.png
 

Attachments

  • upload_2020-12-9_20-15-46.png
    upload_2020-12-9_20-15-46.png
    20.5 KB · Views: 155
Have you tried this?

Code:
command /spectate [<player>]:
    aliases: /spec, /spectator
    trigger:
        if arg-1 is set:
            set player's gamemode to spectator
            set {_player} to "%arg-1%"
            broadcast "%{_player}%"
            teleport player to arg-1

Just teleport the player to the other player (arg-1). Instead of coordinates.
 
I can't find a solution to this but I know I'm not the first person to run into this issue, so sorry if this has already been answered, but how do I teleport a player to another player's coordinates. Sounds confusing, but I'm not trying to teleport a player to another player, but rather their coordinates. Maybe you'll understand if you see my code


Code:
command /spectate [<player>]:
    aliases: /spec, /spectator
    trigger:
        if arg-1 is set:
            set player's gamemode to spectator
            set {_player} to "%arg-1%"
            broadcast "%{_player}%"
            set {_coords} to the location of {_player}
            teleport player to {_coords} in world ul_Ocean

Sorry if that was confusing. Heres the skript error
View attachment 5530
If you want to know why your code was wrong, it is because you said "location of player" in stead of something like "player's location"
 
Have you tried this?

Code:
command /spectate [<player>]:
    aliases: /spec, /spectator
    trigger:
        if arg-1 is set:
            set player's gamemode to spectator
            set {_player} to "%arg-1%"
            broadcast "%{_player}%"
            teleport player to arg-1

Just teleport the player to the other player (arg-1). Instead of coordinates.
Thanks, yea that worked. I overcomplicate things ._.
 
Status
Not open for further replies.