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

Not tp'ing players if touched?

This script is suppose to tp anyone to 1,1,1 if touched a part

script.Parent.Touched:connect(function(hit)
	
		local Player = game.Player.PlayerAdded
		
		Player.Character:MoveTo(Vector3.new(1,1,1))

end)



1 answer

✓ Accepted answer
script.Parent.Touched:connect(function(hit)
for i,v in pairs(game.Players:GetChildren()) do
if v.Character then
       v.Character:MoveTo(Vector3.new(1,1,1))
end
end
end)

When you reference it you only referenced the hit which is an object. To get all the players in the server we use game.Players:GetChildren() then we use a for i,v in pairs to go thru all of them.

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