The script below is in ServerScriptService. What I am trying to do is I have 5 spawns in workspace and only 5 player can be in a server and 1 player has there own spawn. This is not working and I would love some help!
local spawns = {
workspace.spawn1;
workspace.spawn2;
workspace.spawn3;
workspace.spawn4;
workspace.spawn5
};
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
if table.getn(spawns) > 0 then
local randomSpawn = spawns[math.random(#spawns)]
character.Torso.CFrame = randomSpawn.CFrame *
CFrame.new(0,5,0)
end
end)
end)

2 comments
Why are you using table.getn on one line, but the # operator on the next?
Wouldn't it be easier to just use teams if you want them to stick with a single spawn the whole game?