This is only a simple test, I will use it on a folder with +100 IntValue and i want to get the total of them without call them one per one like TotalValue = Value1 + Value2 ect… i dont want that, this is to long.
Here is my script:
while wait(0.1)do
for _, Child in pairs(script.Parent.Parent.Values:GetChildren())do
if Child.ClassName == "IntValue" and Child.Value > 0 then
script.Parent.Value = 0 + Child.Value
end
end
end
This is in a While loops just for the test in a baseplate.
totalValue.Value += child.Value
This work but not fully, the total value always need to be the total of all other value so when there is a loop or the total value change when all other value are changed, the total value keep his old value and add all other value again, so the total value is wrong
while wait(0.1)do
for _, Child in pairs(script.Parent.Parent.Values:GetChildren())do
if Child.ClassName == "IntValue" and Child.Value > 0 then
script.Parent.Value += Child.Value
end
end
script.Parent.Value = 0
end
This work, thanks
It work only with a while loop and not with Child.Changed, but it’s ok
while wait(0.1)do
script.Parent.Value = 0
for _, Child in pairs(script.Parent.Parent.Values:GetChildren())do
if Child.ClassName == "IntValue" and Child.Value > 0 then
script.Parent.Value += Child.Value
end
end
end