Hey! I'd like to stop an animation but I don't know how to stop it.
I know that you can do variable:Stop() but the problem is.... I can't tag the variable!
Why?
I've made a KeyDown event and a KeyUp event. I wanted to make the script play an animation at keydown and stop it at keyup but I have no idea how to access the animation ! :(
The variables:
plr = script.Parent.Parent
char = plr.Character
torso = char:findFirstChild("Torso")
mouse = plr:GetMouse()
The Keydown script:
if key == "f" then
if plr.LEVEL.Value >= 3000 then
game:GetService("Chat"):Chat(plr.Character.Head, "Hado 33: Sokatsui!")
-- Animation ( Charge )
animation = script.animationpackage.kido:WaitForChild("hado33charge")
local animationTrack = char.Humanoid:LoadAnimation(animation)
animationTrack:Play()
-- Effects
torso.Anchored = true
blueflame = Instance.new("Part", game.Workspace)
blueflame.Anchored = true
blueflame.Shape = "Ball"
blueflame.BrickColor = BrickColor.new("Bright blue")
blueflame.Transparency = 0.4
blueflame.Size = Vector3.new(1,1,1)
blueflame.TopSurface = "Smooth"
blueflame.BottomSurface = "Smooth"
blueflame.CFrame = torso.CFrame * CFrame.new(1.6, .25, -1.4)
fire = Instance.new("Fire", blueflame)
fire.Color = Color3.new(0,0,128)
-- End of Effects
else
game:GetService("Chat"):Chat(plr.Character.Head, "I'm not strong enough to use this Hado...")
end
end
and the KeyUp script(unfinished):
function onKeyUp(key)
if key:byte() == 32 then
char.Torso.BodyVelocity:Destroy()
elseif key == "j" then
game.Workspace[plr.Name .. "dankuwall"]:Destroy()
char.Torso.Anchored = false
elseif key == "f" then
animationTrack:Stop()
end
end -- onKeyUp
mouse.KeyUp:connect(onKeyUp)
mouse.KeyDown:connect(onKeyDown)
I hope I've given you enough information.

2 comments
Make animationTrack a variable outside of the keyDown function and get rid of the local before it on line 8 of the keyDown function so that the variable is set correctly. Then you can reference it in the keyUp function.
But KeyUp/KeyDown functions forreal tho... UserInputService/ContextActionService es mastur input race