✓ Accepted answer
To select all players in a game, you can use a for loop.
for i, loopPlayer in pairs(game.Players:GetPlayers()) do
end
Basically, the for loop will get a list of all the current players in the game with game.Players:GetPlayers() and then it will loop through each player found.
Every loop it will assign the variable loopPlayer to the player it has looped through. Then it will do the code to the player, then it will move on to the next player in the game, and do the same code to that player.
For example, if I wanted to kill every player in the game, I could do this:
for i, loopPlayer in pairs(game.Players:GetPlayers()) do
loopPlayer.Humanoid.Health = 0
end
This would loop through every player, then make that player's health 0.
Keep in mind, i is the number amount of times the loop has run, and you can name that to anything. loopPlayer is also just a variable and you can name that to anything.
1 comment
Wouldn't it be easier to just do GetPlayers() and set WalkSpeed and JumpPower to 0 if they aren't you?