Script delaying for some reason

So basically I made a script that makes the player use a magic attack when the key is pressed, but whenever I use the move it sometimes delays for like 5 seconds.
lines of script being used:

The script the event is firing isn’t the reason because sometimes it does work on time but most of the time it doesn’t.

Could you show the spell script?

Sorry for the late reply, was doing other things
The script:

It’s probably to do with the waits.
Put the code in a function, leaving the events outside.
Then you can use coroutine.wrap(functionName)(args)

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