for i = 0, #teleplayers do randomspawn = math.random(1, #spawn_locations) game.Players:FindFirstChild(teleplayers[i]).Character.Torso.CFrame = CFrame.new(spawn_locations[randomspawn]) wait() table.remove(teleplayers, i) wait() end
For an unknown reason I get the error "argument 1 nil value", so it's like not working out that the teleplayers is a value, which is starting to grind my teeth.
CFrame cannot be in a table. Use parts as your spawns. Your argument 1 isn't the teleplayers but the CFrame.new(spawn_locations[randomspawn])
Maybe it should be something like...
game.Players:findFirstChild(teleplayers[i]).Character.Torso.CFrame = spawn_locations[randomspawn].CFrame