local player = game.Players.LocalPlayer
local hum = workspace:WaitForChild(player.Name):WaitForChild("Humanoid")

UIS = game:GetService('UserInputService')
bool = false

local animation = Instance.new("Animation")
animation.AnimationId = "http//roblox.com/asset/?id=1005558412"
local animTrack = hum:LoadAnimation(animation)



local function onkeypress(input, gpe)
	
	if input.KeyCode == Enum.KeyCode.V then
		if bool == false then
		
	
		animTrack:Play()--How long until animation plays.
		bool = false
		end
		
	elseif bool == false then
		
			animTrack:Stop()
			bool = true
		
				
	end
end
 	
game:GetService("UserInputService").InputBegan:Connect(onkeypress)

https://gyazo.com/fc55377ca8d60c022ac3bd13c6974aa8

2 comments

0

for when the animation stops, the event is UIS.InputEnded

0

ok sorry i fixed code why is it not working now