Need help with boolean values

Hi, I’m currently making a combat system. My blocking system heavily relies on bool values (to check if the player is blocking, etc…), mainly because it’s very easy to fetch the value from any script, but I want to find another alternative to this but I’m having a really hard time doing so. I’m also trying to make it so that when you’re performing an action, you cant perform another, the issue can be seen here: https://gyazo.com/e219c0c7597e7dfdf85d26b93a93f8b1.
Now, bool values can be used in this case for creating a corresponding boolean for each and every actions, but as you would have probably guessed there are alot of actions.
TL;DR: Is there any alternative to boolean values that are getting what actions is currently being performed

1 Like

Try looking into fsm (finite state machines), for tracking state.

1 Like

if you’re making many booleans then I reccomend ModuleScript over BoolValues, but keep in mind that the variables in a modulescirpt is not replicated across client and server

You could try doing something like this:

if not isSprinting then
slideAnimation:Play()
end

As suggested, state variables are fine (as long as everything can be contained within a single script/required module script.

After a while of digging I think finite-state machines might just be the perfect solution to this, however, I still haven’t fully had a grasp of this yet and are currently confused as to how I would implement it in the system itself

im gonna bump this post cuz im still struggling with this
Edit: Thank you all for not replying to this, I’m not being sarcastic as it has helped and motivated me to figure it own on my own, turned out FSM was the right call. I’m now going to learn more about this wonderful system such as submachines, multiple actives at once, etc…

1 Like