Need help with loadout system

Hello, and thank you for taking your time out of your day to read this.

I am currently making a loadout system, for a group.
I posted recently today, but i still having troubles with something.

Module script:

Script: image

It only prints out the first one, but i want it to print out all of the player’s loadouts, and groups that they are in. I’m planning on doing something with this.

If you need anything explaining, please don’t hold back.

For the groupIds variable, it doesn’t save 2 values, it just gets one as long as it’s true or anything other than nil or false.

You could use this function instead:

local function PlayerIsInGroup(player: Player) : nil | number
   -- this function loops through the group ids and checks if the player is in them
   for _, id in ipairs(groups) do
      if player:IsInGroup(id) then
          -- if the player is in the current group, this returns the group id
          return id
      end
   end

   -- this returns 'nil' as a default value
   return nil
end

-- example usage
local x = PlayerIsInGroup(Player)
print(x)
-- prints either 'nil' or '(groupid)'

Oh, so ipairs is used for searching through tables?
Never knew that, thank you!