I want to create a button that when someone presses, all players are teleported to the x, y, z area the problem is that this script teleports the player that clicked first and only after a few seconds, other players (tested on LocalServer in Roblox Studio
script:
local teleporte = script.Parent function onClicked() local p = game.Players:GetChildren() for i = 1, #p do p[i].Character:MoveTo(Vector3.new(-55.831, 11.008, 183.894)) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
I don't really know what's wrong with your code but maybe you can try this
local teleporte = script.Parent function onClicked() for i,v in pairs(game.Players:GetChildren())do v.Character:MoveTo(Vector.new(-55.831, 11.008, 183.894)) end end script.Parent.ClickDetector.MouseClick:Connect(onClicked)