Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make it so only one player is teleported?

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

target = Vector3.new(-486.5, -16.79, 486.5)
for i, v in pairs(game.Players:GetChildren()) do 
v.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, i * 5, 0))

1 comment

1

It's in a for loop..

2 answers

✓ Accepted answer

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

--This is the player that will be teleported.
player = game.Players.TargetPlayerName
target = Vector3.new(-486.5, -16.79, 486.5)

--reference the predefined player here
player.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, 5, 0))

5 comments

0

can you make it so it finds the player on a touch

0

because im not using just any player, the "TargetPlayerName" needs to be the name of the player that touches a brick

1

sorry for not accepting this earlier lol

0

LOL THANKS MATE

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

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

end

This discussion is preserved as it was. New answers, comments, and votes are closed.