function onClick(hit) local seeds = script.Parent.Parent.Seeds:GetChildren() for i = 1,#seeds do print(i) for a = 1,#seeds[i].Seed.Value == false do if a == 25 then -- fix this problem if hit.Name == Owner.Value then script.Parent.BrickColor = BrickColor.new("Brown") script.Parent.Parent.GrowthTest.Disabled = false script.Disabled = true end end end end
"Seed.Value" Comes from script.Parent.Parent.Seeds.Seed.Value
what im trying to do is get the value from the bool value inside of Seeds.
basically i have 25 blocks. and inside each block there is a bool value now what im trying to do is count up the amount of blocks i have and then check if all 25 blocks have the bool value set to false the error im getting is "Field.Field.Soil.Sc:22: attempt to get length of field 'Value' (a boolean value)"
If you're looking to see if each value is false, just make a variable that adds 1 each time if the value is false. Then, make an if statement that checks if the amount of seeds with a value of false is equal to the amount of seeds there, like this:
function onClick(hit) local seeds = script.Parent.Parent.Seeds:GetChildren() local falseSeeds = 0 --Variable for keeping the amount of seeds with a value of false in them. for i = 1,#seeds do if seeds[i].Seed.Value == false then --If the seed value is false. falseSeeds = falseSeeds + 1 --Add on to the falseSeeds variable. end end if falseSeeds == #seeds then --Condition that checks if the amount of seeds with a false value equals the amount of seeds found. if hit.Name == Owner.Value then script.Parent.BrickColor = BrickColor.new("Brown") script.Parent.Parent.GrowthTest.Disabled = false script.Disabled = true end end end
I am assuming you've already connected the function to an event and have accounted for all the variables present.
I hope my answer helped you. If it did, be sure to accept it.