Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Selecting all players from game.Players? [ERROR]

Asked by
Hybric 271 Moderation Voter
10 years ago

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"?

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? User#2 0 — 10y

1 answer

Log in to vote
1
Answered by
Tesouro 407 Moderation Voter
10 years ago

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
0
And the wiki recommends a generic for loop, like here. Tesouro 407 — 10y
0
P.s. You can edit your answer to include additional info. adark 5487 — 10y
0
P.s. Whatever. Tesouro 407 — 10y
0
Actually I script I know what to do so..[PS im making Sharks And Minnows game] Hybric 271 — 10y
Ad

Answer this question