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

How to put an animation in a tool? *NEED IMMEDIATE HELP*

Asked by 6 years ago
Edited 6 years ago

I'm having problems putting my custom animation into a tool without a handle. Every time I open it, it plays the animation, but when I move a little, it will stop. Then it won't play again. Here is my script for my frontpike (which works fine) :

Tool = script.Parent local player = game.Players.LocalPlayer repeat wait() until player.Character ~= nil local hum = player.Character:WaitForChild("Humanoid")

local animation = Tool.Front local AnimTrack = hum:LoadAnimation(animation)

Tool.Activated:connect(function(mouse) AnimTrack:Play() end)

Tool.Unequipped:connect(function() AnimTrack:Stop() end)

Here is my script for my front timber (has the problems I explained earlier.):

Tool = script.Parent local player = game.Players.LocalPlayer repeat wait() until player.Character ~= nil local hum = player.Character:WaitForChild("Humanoid")

local animation = Tool.FrontTimber local AnimTrack = hum:LoadAnimation(animation)

Tool.Activated:connect(function(mouse) AnimTrack:Play() end)

Tool.Unequipped:connect(function() AnimTrack:Stop() end)

I really need this to be solved as fast as possible.
0
Please use the lua button and paste the code in there. I'd be much easier for me to read! DaWarTekWizard 169 — 6y

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

Your problem is most likely occurring because the animation for walking overwrites your custom animation. To fix this, you can make your animstion priority higher.

After the line

local AnimTrack = hum:LoadAnimation(animation)

Try adding the line

AnimTrack.Priority = Enum.AnimationPriority.Action
0
Thank you so much! PrettyPrettyPh 5 — 6y
Ad

Answer this question