Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make it so only one player is teleported?

Asked by 8 years ago

This script teleports everyone. Is there a way to make it so it teleports one player instead?

1target = Vector3.new(-486.5, -16.79, 486.5)
2for i, v in pairs(game.Players:GetChildren()) do
3v.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, i * 5, 0))
1
It's in a for loop.. legosweat 334 — 8y

2 answers

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago
Edited 8 years ago

Simply remove your generic for loop, and define a specific player you'd like to teleport and you should be good.

1--This is the player that will be teleported.
2player = game.Players.TargetPlayerName
3target = Vector3.new(-486.5, -16.79, 486.5)
4 
5--reference the predefined player here
6player.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, 5, 0))
0
can you make it so it finds the player on a touch CardboardedCharacter 53 — 8y
0
because im not using just any player, the "TargetPlayerName" needs to be the name of the player that touches a brick CardboardedCharacter 53 — 8y
1
sorry for not accepting this earlier lol CardboardedCharacter 53 — 7y
0
LOL THANKS MATE Goulstem 8144 — 7y
Ad
Log in to vote
-1
Answered by 8 years ago
Edited 8 years ago

Just loop through every player and check for the player you want to teleport.

1for i,v in pairs(game.Players:GetPlayers()) do
2    if v.Name == game.Players.NAMEOFPLAYER then --V is the elements inside the table
3            --do your normal teleport stuff
4    end
5 
6end

Answer this question