How would I add blocking?

I was looking to script a fighting system. Previously, making fighting systems I would make an attribute in the humanoid called “fighting state” which would consist of a string describing what they are doing punching, i-frame, blocking, stunned, etc. Is there a better practice for implementing blocking?

Edit: Don’t give me a script, or a tutorial I just want a basic idea.

I usually also do it the way you are doing it, just with the value inside the sword, not the humanoid. However, I also usually add stunned to the weapon states, atleast after a failed block.
Another way I could imagine you doing it is having a bunch of bool values in the actual sword, that way you could have multiple states at once, but I never really worked on too advanced systems, so only one string always was enough for me.

for Stunned in particular, we can create a BoolValue named “Stunned” and parent it into player’s character. Add to debris for clean up after stun duration.
Link event to player character.ChildAdded and ChildRemoved, increment/decrement a ‘stunnedCount’ if the child is named “Stunned”. if this count is greater than 0, then the player is stunned.

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