#How to Check for varying values in a table

1 messages · Page 1 of 1 (latest)

median barn
#

I have a table with IntConstrainedValues and BoolValues, and I want to check something like
"If all IntConstrainedValues are at their max values and all boolValues are true, then.."
how would i do that?

cursive fox
#

for loops

median barn
#

i mean yeah that, idk how to say "if all of them are true/max value" though

drowsy mulchBOT
#

studio** You are now Level 9! **studio

main nimbus
#

still need help?

cursive fox
#

do not fear an s4 is here

median barn
main nimbus
#
local function isAllTrueMax()
  for  _, v in whereTheValuesAre:GetDescendants() do
    if v:IsA("IntConstrainedValue") then
      if v.Value ~= v.MaxValue then return false end
    end
    if v:IsA("BoolValue") then
      if not v.Value then return false end
    end
  end

  return true
end
cursive fox
#

so i was right...... i second guessed my self and didnt send cuz i ain want my s1 revoked for sending something thats basic knowledge but it doesnt work...

median barn
median barn
#

yooo thats smart

#

so if i wanna see the function i can just set a variable to the return and connect it to a separate function if it's true then

#

thanks man

median barn
#

hold on so i tried connecting the return and saying "if [return variable] then [complete function] else return end"

#

didnt work

#

what's happening

main nimbus
#

can u send what u wrote

median barn
main nimbus
#

what is complete check

#

and what is done

median barn
#

completeCheck is just what you wrote out for me, done() is what I want to happen if it returns true

#

the error comes in with checking the return value as a boolean

main nimbus
#

done will run for every single thing that has the right value

median barn
#

oh true i gotta fix that

#

the other problem is that it doesn't recognize the return value correctly

median barn
main nimbus
#

no it's doing it in a loop

#

so it will do it right after it validates

#

and then it won't return so it will continue the loop

#

i recommend u do the rewards separate from updating the text

median barn
#

i was trying to make it so everytime something is completed it would check again, what should i do instead

cursive fox
#

"nothing better than that thrill you get from solving a bug solo dolo, imo" - Me

median barn
#

💀

#

does roblox even let me return raw values

#

i tried it with a number value too and wouldnt work

#

does it have to be a variable

main nimbus
#

do a .Changed event for all of them

#

connect them all to the same function

median barn
#

like for every individual req, I'd check again then

#

wait yeah i already did that

main nimbus
#

ye something like that

median barn
#

yeah it works fine, the only problem i can even see so far is that I can't return the true/false statement from the function