gcount = 0
local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local zanim = Instance.new("Animation")
zanim.AnimationId = "http://www.roblox.com/asset/?id=1556407132"
local diveanim = Instance.new("Animation")
diveanim.AnimationId = "http://www.roblox.com/asset/?id=1556546195"
mouse.KeyDown:connect(function(key)
if key == "z" then
if gcount >4 then
local playAnim = humanoid:LoadAnimation(diveanim)
playAnim:Play()
gcount = 0
else
local playAnim = humanoid:LoadAnimation(zanim)
playAnim:Play()
gcount = gcount + 1
wait(1)
if gcount >4 then
local playAnim = humanoid:LoadAnimation(diveanim)
playAnim:Play()
gcount = 0
end
end
end
end)
If the user presses the animation too often, they should be able to fall over.
There's just something I'm doing wrong, the animation can be 'restarted' while they are using it, and I thought I could fix it by using wait(animation length) but obviously not.
It plays the original animation but I don't know how to make it unable to play the same animation again, like having a cooldown on the animation
I'm aware it's really inefficient as well
;)
Thanks

2 comments
Debounce?!
http://wiki.roblox.com/index.php?title=Debounce