I'm using roblox studio client test using 2-4 players and when they all join at the same time only one base spawns and not the rest. I know people use :WaitForChild("") or something like that. Can someone help me? Heres my code
local table = game.ReplicatedStorage:WaitForChild("Teams"):GetChildren() local random = math.random(1,#table) local base = table[random] game.Players.PlayerAdded:Connect(function(player) while true do wait() if base.Owner.Value == "" then base.Name = player.name.."'s Base" base.Owner.Value = player.name base.Parent = game:WaitForChild("Workspace") local spawnbase = Instance.new("SpawnLocation",base) spawnbase.Position = base.SpawnPoint.Position spawnbase.Duration = 3 spawnbase.Anchored = true spawnbase.Transparency = 1 spawnbase.CanCollide = false break end end end) game.Players.PlayerRemoving:Connect(function(player) base.Owner.Value = "" base:Destroy() end)