local tool = script.Parent local animation = tool:WaitForChild("Animation") local animation2 =tool:WaitForChild("Animation2") local player = game.Players.LocalPlayer local animationtrack local buttonpressed = false tool.Equipped:connect(function() local character = player.Character local humanoid = character:WaitForChild("Humanoid") animationtrack = humanoid:LoadAnimation(animation) animationtrack:Play() end) tool.Activated:connect(function() if not buttonpressed then buttonpressed = true local character = player.Character local humanoid = character:WaitForChild("Humanoid") animationtrack = humanoid:LoadAnimation(animation2) animationtrack:Play() wait(3) buttonpressed = false end end) tool.Unequipped:connect(function() animationtrack:Stop() end)
There are a few problems going on here... 1. If I try to unequip the tool while the animation is playing the character doesn't go back into its default position. The character stays in the position of the first animation 2. If I try to unequip the tool after I play the animation once or more, when I unequip the tool, the character again stays in the position of the first animation. :P Please help!
The method Stop of the AnimationTrack will make the animation end when you call it. When your tool is unequipped, call this function to end your animation prematurely.
Thx but I don't completely understand what you're saying. Do you think you could modify my script and show me what you mean?