A scripter on here improved my script and gave me this:
local Players = game:GetService("Players")
local function GetActiveRoles(Player)
local ActiveRoles = {}
local Stats = Player:WaitForChild("Stats")
for _,Role in pairs(Stats:GetChildren()) do
if Role.Value ~= false and Role.Name ~= "Coins" or Role.Name ~= "Gems" then
table.insert(ActiveRoles, Role.Name)
end
end
print(unpack(ActiveRoles))
end
Players.PlayerAdded:Connect(GetActiveRoles)
I made some changes, and I simply don't understand, why the unpacked table shows me EVERYTHING inside of player, and not just every "role" that has been bought by the player (Booleans).

3 comments
Maybe move the
Role.Valuepart to the other side of the or. Cause "or" separates the next parameter from all the previous ones, not just the one parameter before it. If you already know this, and already tried it, my apologiesJust check if the Role:IsA("BoolValue") and Role.Value ~= false then add it to the table
it doesn't print out anything.