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

How to insert animations into specific tools?

Asked by 8 years ago

How would I insert specific animations into tools, such as a bomb, I made a throwing animation but how do I get it to work?

P.S. Im new to animations

0
Just make the animation run when you click, or equip the tool, or whatever. http://wiki.roblox.com/index.php?title=Animations Perci1 4988 — 8y
0
Im sorry again im new, how would I do that, thats the question.. sentry3 6 — 8y
0
you read the wiki and learn it and practice it Perci1 4988 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Tool = script.Parent
local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
local hum = player.Character:WaitForChild("Humanoid")
local animation = script.Parent.ExportAnim --Change DanceAnim to the name of your animation.
local AnimTrack = hum:LoadAnimation(animation) --Loads the animation into the humanoid.
Tool.Activated:connect(function(mouse) --If you're using a tool, change Selected to Activated, and get rid of the code on the next line. Otherwise, keep this the same.
        AnimTrack:Play()
    end)
end)
Tool.Unequipped:connect(function() --If you're using a tool, change Deselected to Unequipped. Otherwise keep it the same.
    AnimTrack:Stop()
end)

How do I get this script to play when I use the tool?

Ad

Answer this question