Hello! I have a script for the animation for my simulator game. The animation is a weightlifting animation. I want it so the player has to wait until the animation is over before they can click to make the animation happen again, rather than spam clicking and making the animation keep restarting.
Here is my script. How would I edit this to make this work?
4 Likes
Add a debounce;
local debounce = false
if debounce == false then
animation:Play()
debounce = true
wait(animation length)
debounce = false
3 Likes
Whereabouts on the script should I put that?
At the beginning of the script, local debounce = false.
After the mouse button down function, the if statement.
After animation:Play(), debounce = true, then the wait, then the debounce = false.
1 Like
Ive done it but now the animation doesn’t work when I click.
Can you post your script here, please?
You put an extra parenthese after the end.
2 Likes
Nevermind, I fixed the error thanks for your help
Instead of adding a wait(), you should use Animation.Stopped:wait()
.