the title explains it all.
if you hold the keys for a while after releasing the keys the animation loops itself even after the keys aren't being held anymore.
Script:
local Player = game.Players.LocalPlayer local Character = Player.Character local UIS = game:GetService'UserInputService' local keyCodeQ = Enum.KeyCode.Q local keyCode_E = Enum.KeyCode.E UIS.InputBegan:Connect(function(input, chatting) if chatting then return end if UIS:IsKeyDown(keyCodeQ) and UIS:IsKeyDown(keyCode_E) then local Anim = Instance.new('Animation') Anim.AnimationId = 'rbxassetid://2007811727' PlayAnim = Character.Humanoid:LoadAnimation(Anim) PlayAnim:Play() end end) UIS.InputEnded:Connect(function(input, chatting) if chatting then return end if not UIS:IsKeyDown(keyCodeQ) and not UIS:IsKeyDown(keyCode_E) then PlayAnim:Stop() end end)
There is a function called InputEnded and you can use it similar to InputBegan. Inside the InputEnded function you can tell your script to stop.