Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with animations?

Asked by 9 years ago
01local tool = script.Parent
02local animation = tool:WaitForChild("Animation")
03local animation2 =tool:WaitForChild("Animation2")
04local player = game.Players.LocalPlayer
05 
06local animationtrack
07local buttonpressed = false
08 
09tool.Equipped:connect(function()
10    local character = player.Character
11    local humanoid = character:WaitForChild("Humanoid")
12    animationtrack = humanoid:LoadAnimation(animation)
13    animationtrack:Play()
14end)
15 
View all 35 lines...

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!

2 answers

Log in to vote
0
Answered by 9 years ago

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.

0
I already have stop in my script though... help! swimmaster07 25 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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?

Answer this question