In game, if I punch, I can't do so again for roughly 5 seconds. Why is this? It's quite annoying, I really would like to get rid of it.
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local Hum = char:WaitForChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://855470374" -- Punching Animation
wait()
local animTrack = Hum:LoadAnimation(animation)
game:GetService("UserInputService").InputBegan:connect(function(Key)
if Key.KeyCode == Enum.KeyCode.E then
animTrack:Play() -- Initiate the Punching Animation
end
end)
Is it a problem with my punching animation, or the script?

6 comments
Sorry for all the questions lately, by the way. I'm just very terrible with UserInputService in general.
bump
BUMP
Are you sure the animation isn't 5 secnds long?
Oh, sorry, I forgot to mention that I did indeed fix it.
I created a variable to block the user from triggering an event when E is pressed if it equaled one. Then, I made it to where if you pressed E, it would set it to 1, wait 0.9 seconds, stop the animation, and set the variable to 0.