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

how do I find a player in the players without knowing their name? [closed]

Asked by 10 years ago

I want to write a script builder script that will kill all the players but I don't know how to do that without knowing anyones names... any help

Closed as Not Constructive by AmericanStripes

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
jakedies 315 Trusted Moderation Voter Administrator Community Moderator
10 years ago

You can iterate through the players service and for each of them, call the BreakJoints function on their character.

local players = Game.Players:GetPlayers(); -- Store a table of all the players in the players service.
for key = 1, #players do -- Set key to 1, every iteration increase it by 1 until it reaches the length of the players table
    players[key].Character:BreakJoints(); -- Call BreakJoints on each player's character to kill them
end
Ad