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

How to put all players inside of a table?

Hello all! So, I know how to put all players in a table, but here is my issue: I have an admin script, and for the player parameter, if you're putting multiple, you need to do it all at once. Example:

Command("Kill", game.Players:GetPlayers())

So, I thought, to put selected players in a table.

Table = {"Player","Shawnyg"}

And here is my issue: How do I execute the command with all of the players in the table? I know you're gonna say loop through it with a for loop, but then, it'd be running the command multiple times, which wouldn't work with my script. Any tips?

3 comments

0

Why won't a for loop work? for i,v in pairs(table) do v.Character:BreakJoints() end

0

It's a bit hard to explain. :/ Do you have any advice?

0

I don't understand why the for loop won't work. You already did the hard part, getting the string separated and into the table in the first place.

1 answer

local player = game.Players:GetPlayerFromCharacter
local Table = {player}
function kill()
if (player ~= nil) then
player:Breakjoints()
else print "Nope"
end
while true do
wait(2)
kill()
end

2 comments

2

This script is wrong in so many ways...

1

Thank you, bro. You made me laugh today.

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