What would be the best way to go about finding out when multiple values are true?

I’m currently developing a system not too similar to the game “Deepwoken’s” parrying system.
When you miss your parry, it goes off cooldown. And when you gain back your ability to parry, it plays a short gui animation like this.


I have an in-script value/variable and an out of script value.
The in-script value/variable that constantly counts down from -=1~ and stops when it hits 0. i.e local value1 = 10
The out of script value gets set to true or false every now and then. i.e a BoolValue

How can I make it play an animation like this every time the in-script value is worth 0 and the out of script value get set to false? (I can probably figure out how to make it only activate once before it either of the values get set to something different)

Try using GetPropertyChangedSignal on the out-of-script value.

local function checkBothValues()
    if Value1.Value == 0 and Value2 then
        print("They are both good!")

1 Like

GetPropertyChangedSignal(“Value”):Connect(checkBothValues) Shouldn’t be able to
work with in-script values and variables like
“local value1 = 2”.
Is there anything of the equivalent of that?
Although, mb for not clarifying well enough what these values meant.

Sorry, I assumed that there was a value instance outside of the script (e.g. BoolValue). There’s no in-script equivalent, you might just need to run the function each time you update the value.

1 Like

Darn. Is running the fuction each time I update the value even optimized though? (It decreases through the usage of a complicated renderstepped_ function.)

I think it’s the most efficient way, or at least I can think of right now.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.