Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Selecting all players from game.Players? [ERROR]

I tried to make a line that gets all the players and kills them, But this will get only one player:

local pl = game.Players:GetChildren()
	for i = 1, #pl do
pl[i].Character:BreakJoints()
end 

Why isn't this getting all players from "game.Players"?

1 comment

0

This does exactly as intended, what you have provided works as you wish for it to. It could be something else factoring in. Are you sure that this is being run when there is more than one player in the game?

1 answer

✓ Accepted answer

There is a method called GetPlayers, you use that to get players:

for i, player in pairs(game.Players:GetPlayers()) do
	player.Character:BreakJoints()
end

4 comments

0

And the wiki recommends a generic for loop, like here.

0

P.s. You can edit your answer to include additional info.

0

P.s. Whatever.

0

Actually I script I know what to do so..[PS im making Sharks And Minnows game]

This discussion is preserved as it was. New answers, comments, and votes are closed.