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)
Add a value for each spawn. When a player spawns onto that spawn the value = true so no one else can touch it.