hello, so i have this line of code that is suppose to print a random part called “SpawnPoint” but its printing out every part thats called “SpawnPoint”
Feel free to ask any questions
hello, so i have this line of code that is suppose to print a random part called “SpawnPoint” but its printing out every part thats called “SpawnPoint”
Feel free to ask any questions
The code is doing its job correctly if it prints out every possible spawn point. You are iterating upon a table meaning after it has finished one cycle it will repeat itself until it has iterated upon each player.
Maybe try to do it outside of the loop?
local chosenSpawn = spawns[math.random(1,#spawns)]
print(chosenSpawn)
for i,v in pairs (game.Players:GetPlayers()) do
v.Character.HumanoidRootPart.CFrame = chosenSpawn.CFrame
end