How to make an attack system

Hello, I want to know, how do I make a script where if a player presses any key and holds it, their character does a handsign animation and it does a holding animation until they release the key, and then when they release the key, it fires an attack. But I also want it so that if they release the key before the handsign animation is done, then it doesnt release the attack.

1 Like

You can use the Context Action Service or User Input Service to get the initial input from the player. To determine the length they’ve held it down, you can start a timer on (UserInputState.Begin) and stop it at (UserInputState.End) and if the difference is equal to whatever you’d like the limit to be, you can then initiate the attack; if it doesn’t reach the limit, then don’t perform the attack.

This is just a rough plan, you’ll still need to do some additional work to get this functioning.

1 Like