I am trying to make the player not spawn on the same spawn but randomly at the same time, it works for spawning random but sometiems the player spawn on each other.
local SpawnPoints = ClonedMap:FindFirstChild("SpawnPoints")
local AvailableSpawnPoints = SpawnPoints:GetChildren()
for i, player in pairs(plrs) do
if player then
character = player.Character
if character then
print(player.Name.." is about to be teleported")
character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[math.random(#AvailableSpawnPoints)].CFrame + Vector3.new(0,10,0)
end
Sorry for the crappy format but this should solve your issue.
local SpawnPoints = ClonedMap:FindFirstChild("SpawnPoints")
local AvailableSpawnPoints = SpawnPoints:GetChildren()
for i, player in pairs(plrs) do
if player then
character = player.Character
if character then
print(player.Name.." is about to be teleported")
local ind = math.random(#AvailableSpawnPoints)
character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[ind].CFrame + Vector3.new(0,10,0)
AvailableSpawnPoints[ind]:Destroy()
end