In my game, I have two groups that a person can be in: players and watchers. In order to determine who is a player and who is a watcher, each player gets an overhead GUI placed in their head brick as a sort of tag which says either player or watcher. I was wondering how to place people into either a player table or a watcher table based on their tag in order to keep track of who is in each group in case they switch groups later on in the game. I'm new to scripting and I'm not sure how to go about this. I still have a lot to learn. Thank you in advance for your help. It's greatly appreciated.
Edit - I have made a player list GUI in starter GUI but I can't figure out how to put only the players with the player tag into the list and not the ones with the watcher tag.
First, loop through the players.
for i,p in pairs(game.Players:GetChildren()) do --looppppp
After, you'd need to use whatever way you have to get their role.
for i,p in pairs(game.Players:GetChildren()) do --looppppp local role = p.RoleThingy
Then, place them in one of two tables using table.insert
based on their role.
You could, however, just use a table inside of another...
local roles = {} for i,p in pairs(game.Players:GetChildren()) do --looppppp local role = p.RoleThingy table.insert(roles,{p=role.Role}) end