Does anyone know how I can fix this -
It’s teleporting every player because of this line of code. It’s getting all the children under players.
-- local p = game.Players:GetChildren()
FULL CODE -
function onClicked()
local p = game.Players:GetChildren()
for i = 1, #p do
p[i].Character:MoveTo(Vector3.new(53.585, 1.109, 85.692))
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
local Players = game:GetService('Players')
script.Parent:FindFirstChildOfClass('ClickDetector').MouseClick:Connect(function()
for __, Player in pairs(Players:GetPlayers()) do
local PlayerCharacter = Player.Character
if PlayerCharacter then
PlayerCharacter:MoveTo(Vector3.new(53.585, 1.109, 85.692))
end
end
end)