I need help. When I click my mouse it plays the animation, but if I keep clicking it repeats it. How could I make it wait for the animation to play before being able to play again? This is what I have so far. Thanks.
local animation = script.Parent.Animation local Tool = script.Parent local animTrack = nil Tool.Activated:connect(function() animTrack = script.Parent.Parent.Humanoid:LoadAnimation(animation) animTrack:Play() end)
local animation = script.Parent.Animation local Tool = script.Parent local animTrack = script.Parent.Parent.Humanoid:LoadAnimation(animation) Tool.Activated:connect(function() if animTrack.IsPlaying == false then animTrack = script.Parent.Parent.Humanoid:LoadAnimation(animation) animTrack:Play() end end)
Here is the script;
local animation = script.Parent.Animation local Tool = script.Parent local animTrack = script.Parent.Parent.Humanoid:LoadAnimation(animation) local canplay = true Tool.Activated:connect(function() if canplay then canplay = false animTrack:Play() animTrack.Stopped:wait() canplay = true end end)
canplay
is a bool value, and a debouncer. If you do not know what a debouncer is then I would suggest looking it up on YouTube.