What i want is that when i click a gui button (for example), its check in my leaderstats and look in all the values if they = 1 and set them to 0 if they = 1. Its like a "GetChildrenWhichEquals". Im not really good to explain but i think you understands.
You can write a function for it:
GetChildrenWhichEquals returns a table with all the value objects that equal number
function GetChildrenWhichEquals(parent, number) local childrenWithValue = {} --go through all the parents children: for _, child in pairs(parent:GetChildren()) do -- if child is a value object then if child.ClassName:sub(-5) == "Value" then --check if the child's value equals value specified if child.Value == number then table.insert(childrenWithValue, number) end end end return childrenWithValue end local leaderstats = game.Players.LocalPlayer.leaderstats local children = GetChildrenWhichEquals(leaderstats, 2)