Random Spawn point teleporting

So i have made a map voting system and a map loading system, tho i dont know how can i randomize the spawnpoints for every player: here is the code i got for teleporting, i just need to randomize:

-- ofc before this, there is more code LOL, but here is also a list of all spawns
					humanoidrootpart.CFrame = clonemap.SpawnPoints.A.CFrame + Vector3.new(0,3,0);
					humanoidrootpart.CFrame = clonemap.SpawnPoints.B.CFrame + Vector3.new(0,3,0);
					humanoidrootpart.CFrame = clonemap.SpawnPoints.C.CFrame + Vector3.new(0,3,0);
					humanoidrootpart.CFrame = clonemap.SpawnPoints.D.CFrame + Vector3.new(0,3,0)

first make a variable regarding all of your spawn points

local spawnPoints = spawnpointfolder:GetChildren()

then loop through every player and run

local chosenSpawn = spawnPoints[math.random(1,#spawnPoints)]
hrp.CFrame = chosenSpawn.CFrame + Vector3.new(0,2,0)
1 Like

im going to try that, ty :smiley: …im going to tell you if it works (ofc it will)