Hi I made a tp script. It should only tp the person who pressed the button but it teleports everyone in the game.
function onClicked() local p = game.Players:GetChildren() for i = 1, #p do p[i].Character:MoveTo(Vector3.new(-1575.5, -18.75, -1088.5)) end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
How can I fix this?
function onClicked(plr) local Character = game.Workspace:WaitForChild(plr.Name) if Character then Character:MoveTo(Vector3.new(-1575.5, -18.75, -1088.5)) end end script.Parent.ClickDetector.MouseClick:Connect(onClicked)