
Literally cannot figure out what went wrong, I don’t think i can get any simpler either, help. ( it doesnt print “:(” )
These 4 lines of code aren’t even working on a script on it’s own
Please use #targeted == 0 if you’re trying to check if it’s empty.
To explain what this does:
-
#operator counts the items in an array(do not use in dictionaries) -
targeteddeclared is an empty table -
#targetedequals to 0 entries in table -
0 == 0results intrue
Just curious, why not table.getn() ?
When you do targeted == {} it’s comparing the memory addresses and not deep comparing those tables to see if they contain the same elements. They’re not stored at the same address therefore your condition evaluates to false, and the print statement doesn’t run.
Interesting, maybe it’s also an option. It’s just that the table.getn() is new. Usual way to do it is with the # operator.
https://create.roblox.com/docs/reference/engine/libraries/table#getn
what exactly are you trying to check for?
They are equivalent in luau.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.