Randomize spawn doesn't work "1 is not a valid member of Folder"

I don’t know what to do.

local TeamFolder = workspace["Spawn Locations"][Player.Team.Name]
local SpawnLocation = TeamFolder[math.random(1, #TeamFolder:GetChildren())]
			
Events.SpawnEvent:FireServer(Player, SpawnLocation)
 1 is not a valid member of Folder "Workspace.Spawn Locations.ATF" 

Why do you have a Player Variable?

local TeamFolder = workspace["Spawn Locations"][Player.Team.Name]
local children = TeamFolder:GetChildren()

local Spawn = children[math.random(1, #children)]

SpawnEvent:FireServer(Spawn)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.