Hi, in my game script I have multiple sections where I need to get all the players in the game. But with my script it only gets the first player that joins the server. Can you please help? Here's a part of the script where it gets the first player that joins the server:
for i, player in pairs (Game.Players:GetChildren()) do if player.Character and player.Character:FindFirstChild("Torso") then player.Character.Torso.CFrame = SpawnPositions[math.random(1, #SpawnPositions)] + Vector3.new(0, i * 5 ,0) Game:WaitForChild("ReplicatedStorage") local bomb = Bomb:Clone() bomb.Parent = Game.Workspace Game.Workspace.bomb.Position = PossiblePositions end
Everything here is defined
If you could help that would be amazing!
Maybe try adding the players to a table as they enter like this:
local PlayerTable = {} game.Players.PlayerAdded:connect(function(Player) PlayerTable[#PlayerTable + 1] = Player end)
You're only searching it once. Try adding a loop.
Unless its in a minigames-ish script, in which case i cant see the error