Hello everybody. So I want to teleport players to a brick. But the script below only teleports 1 player in the server. And not everyone. How do I fix it? Thanks.
--spawns is the part i want people to teleport to spawns = game.Workspace.spawns for i,v in pairs(game.Players:GetPlayers()) do local name = v.name local checkplayer = check:FindFirstChild("Humanoid") if checkplayer then v.Character.HumanoidRootPart.CFrame = spawns.CFrame
When the game starts, this script is running instantly, and probably most of the player's characters haven't loaded in yet. This means checkplayer
would be nil
and the teleportation wouldn't take place.
You can add a wait in the beginning but I suggest you change
local checkplayer = check:FindFirstChild("Humanoid")
to
local checkplayer = check:WaitForChild("Humanoid")
This would hold the script until the child is found, which is the Humanoid. This would mean it won't skip over certain players who haven't fully loaded in yet, it would wait for them.