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

How do I make a script sort through a table?

Asked by
xEiffel 280 Moderation Voter
6 years ago

I'm making a game and I have a table.insert() script that includes all the current players in the player service. I want each player to take turns separately but other players to watch[I have the watch script in place], so in order of the table it will give them their turn and I already have a table.remove() script for when they finish their turn. I just would like to know how to make it so that players take turns in the table for their order,

Help is appreciated, Links would be great to find out about this.

1 answer

Log in to vote
0
Answered by
dispeller 200 Moderation Voter
6 years ago

This might help

for num,Obj in pairs(game.Players:GetChildren()) do
    -- do stuff for each 
end

or

for num,Obj in pairs(game.Players:GetPlayers()) do
    -- do stuff for each 
end
0
Thanks! xEiffel 280 — 6y
Ad

Answer this question