Now I know that this exists : but I am confused on how I would use this. I want to make it so I can Get All The Groups the player is in then get the primary groups and do somthing with that. Here is my test code that didn't work.
function playerJoin(player) local a = player:GetGroupsAsync() print(a) end game.Players.PlayerAdded:connect(playerJoin)
This article supposes GetGroupsAsync() is an existing function obtaining the player's groups
You cannot directly print tables. What you will have to do is get each item of the table and print it one-by-one. This goes for every table you want to obtain the items from.
So we use this for i=1
loop, as an example, to get them:
function playerJoin(player) local g = player:GetGroupsAsync() for i=1,#g do --I will start from 1 and increase up to the number of groups print(g[i]) --Each group in the table is chosen with i end end game.Players.PlayerAdded:connect(playerJoin)
There are a few other ways to get the items, but this is the most efficient way known.