Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I prevent the "reset" of one animation?

Hello ScriptingHelpers,

This is a simple question but not too simple for me. How can I prevent the "reset" of one animation?

I mean, I have an animation, when I press Space the animation starts. If I press Space multiple times the Animation stops and start again and looks pretty bad.

I want that if the Player hits the Space multiple times don't do anything before the Animation ends.

I was thinking about using the wait() function but I don't really know how to implement that with animations.

I really appreciate any help you can provide.

2 comments

2

Use debounces

0

Sadly I can't upvote your comment, but thank you very much HospitalDev that's exactly what I needed.

1 answer

✓ Accepted answer

Debounces are a good way of doing this, as with the touched event.

Example:

local debounce = false

script.Parent.Touched:connect(function(playerWhoTouched)
	if not debounce then --If the debounce isn't activated
		debounce = true --Activate it
		print("TOUCHED")
		wait(5)
		debounce = false --Deactivate It
	end
end)

To those who look at this answer, please excuse my wording!

This discussion is preserved as it was. New answers, comments, and votes are closed.