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

Not teleporting players to a part in a group called "Spawns"?

Not teleporting players to a part in a group called "Spawns"?

for _, player in pairs(game.Players:GetChildren()) do
	local spawns = game.Workspace.Spawns:GetChildren()
	local char = player.Character
  if char ~= nil then
  	local num = math.random(1, #spawns)
  	local spawnChosen = spawns[num]

  		if char ~= nil then
  			char:MoveTo(spawnChosen.Position)
  		end
	end
end

3 comments

0

Use CFrame instead of MoveTo 'char.Torso.CFrame = spawnChosen.CFrame'

0

MoveTo will work just fine

0

i ran a little test on this script and i think i got your problem

1 answer

✓ Accepted answer

try this. your code fires as soon as the server starts up. put a wait for a few seconds and it should work.

the player is not in Players when the code gets the players table

i did test this solution a lot for you

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