✓ Accepted answer
You have the right cocept, just you're using the return statement inproperly.
The return statement is a statment that should be used in a function. It makes whatever function you used the statement on return the given argument, and also discontinues the function. Example;
function add(a,b)
return a + b
print('lol')
end
print(add(1,3))
But that's besides the point. Instead of returning false, set the value to false.
local gather = workspace.Model1:GetChildren()
for i = 1,#gather do
if gather[i].Value == true then
gather[i].Value = false
end
end
Additional changes - you can use a generic for with the Pairs function.. which is actually meant to iterate through tables.. also you can 'toggle' the value by doing value = not value.
local gather = workspace.Model1:GetChildren()
for i,v in pairs(gather) do
v.Value = not v.Value
end
for i,v in pairs(gather) do
if v.Value then
v.Value = false
end
end
1 comment
Ty