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

How to implement animations into a tool?

Asked by 4 years ago

Recently I made a few animations for swords. I wanted to know how to get certain animations to play when the tool is in and out of your inventory. I would also know how I could play an animations that gives me the tool such as taking a sword/gun off my back and then being able to put it back on.

1 answer

Log in to vote
0
Answered by 4 years ago

heres how I do it:

insert a local script into your tool and insert your animations into the local script

assuming an animation is called "attack":

script.Parent.Activated:Connect(function()
   local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.attack)

   attack:Play()
   wait(1) -- duration of animation 
   attack:Stop()
end)

and you can do the same for tool.Equipped and tool.Unequipped, using your defined animations

the secret is that it gets put in your backpack and calling script.Parent.Parent gets the character

script.Parent = backpack

backpack.Parent = character

Ad

Answer this question