Substituting Bools with Numbers for certain use cases?

Let me paint a picture: You have a want to make slowness a toggle-based debuff on your humanoid and when said value is true, the character is slowed. Now let’s say two sources provide said slowness, if one ends before the other does it will become a normal speed even though technically you should still have slowness because another source provided it, so what is a solution?

After a little bit of theorizing and testing I have found that using number values in place of bools work well! Let’s put the same situation but with a number value, the debuff would only be active when the number is above 0, meaning if two sources are active it’ll become 2, and if one ends it’ll still be above zero because as we all know: 2 - 1 = 1, meaning it would still count as true and not end early.

The reason I’m bringing it up now though is because while yes this type of tech could be niche, I still have not seen it discussed and I’m wondering if I came up with something new or something everyone already knew about but found a better option for.

If anyone has any comments or questions about this it would be really appreciated!

That’s overall not a bad idea.
Just be careful
You mean using numbers as a sort of currency that stacks up and, when it reaches 0, loses all debuffs?
If so, then yeah, very decent implementation, maybe the best for Luau even as of 2025.

Yeah, that’s the norm i think, take Dark Souls debuffs as an example, it’s a number that goes up, when it reaches max it debuffs you, when it reaches 0 the debuff ends.

Keep in mind I’m not using it as a way to make debuffs stack or amplify, it’s just a way for multiple sources to not cancel each other out as if it were a normal bool