Help with animations?
01 | local tool = script.Parent |
02 | local animation = tool:WaitForChild( "Animation" ) |
03 | local animation 2 = tool:WaitForChild( "Animation2" ) |
04 | local player = game.Players.LocalPlayer |
07 | local buttonpressed = false |
09 | tool.Equipped:connect( function () |
10 | local character = player.Character |
11 | local humanoid = character:WaitForChild( "Humanoid" ) |
12 | animationtrack = humanoid:LoadAnimation(animation) |
19 | tool.Activated:connect( function () |
20 | if not buttonpressed then |
22 | local character = player.Character |
23 | local humanoid = character:WaitForChild( "Humanoid" ) |
24 | animationtrack = humanoid:LoadAnimation(animation 2 ) |
33 | tool.Unequipped:connect( function () |
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!