I need a piece of code that when u spam the key (In my case e) It only plays until it finishes.
local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid local humanoid = player.Character.Humanoid local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=03836741039" mouse.KeyDown:connect(function(key) if key == "e" then local playAnim = humanoid:LoadAnimation(anim) playAnim:Play() end end)
Check when the animation track isPlaying property is true
local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid local humanoid = player.Character.Humanoid local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=03836741039" local UserInputService = game:GetService("UserInputService") animationTrack = humanoid:LoadAnimation(anim) UserInputService.InputBegan:Connect(function(input, gameProcessed) if input.UserInputType == Enum.UserInputType.Keyboard then if(input.KeyCode == Enum.KeyCode.E)then if(not animationTrack.IsPlaying)then animationTrack:Play() end end end end)