My tool's holding animation wont play i cant figure out why?

NoobletDeveloper

New Member
Nov 17, 2018
7
0
1
Roblox
NoobletDeveloper
So i made an animation for a tool but it does the animation after i have un equipped the tool

my script:

"script.Parent.Equipped:Connect(function()
local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
animation:Play()
end)"
 

MythicalShade

Member
Nov 10, 2018
111
11
18
Roblox
MythicalShade
You can use the tool.Unequipped event to detect when the tool is no longer equipped, then stop the animation. This code plays the animation as long as the tool is equipped, then stops as soon as it is unequipped.

Code:
local player = game:GetService("Players").LocalPlayer
local character = player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local tool = script.Parent

local animation = humanoid:LoadAnimation(tool.Animation)

tool.Equipped:Connect(function()
    animation:Play() -- Play Animation when tool is equipped
end)

tool.Unequipped:Connect(function() -- Unequipped event
    animation:Stop() -- Stop Animation when tool is no longer equipped
end)
 

NoobletDeveloper

New Member
Nov 17, 2018
7
0
1
Roblox
NoobletDeveloper
thank you
Post automatically merged:

for whatever reason the animation still does not play ;-;
 

MythicalShade

Member
Nov 10, 2018
111
11
18
Roblox
MythicalShade
thank you
Post automatically merged:

for whatever reason the animation still does not play ;-;
It's likely a problem with the animation itself then, might be the the animation priority or some other factor. Also it has to be your own but I'm sure you know that
 

NoobletDeveloper

New Member
Nov 17, 2018
7
0
1
Roblox
NoobletDeveloper
I did make the animation myself and im not sure what the issue is I will probably just not include the tool in my game. Thanks for your help though
 

LuisDaGamer

Active Member
Apr 19, 2018
917
108
43
The Internet
Roblox
Surf4cePen
Discord
Surf4cePen#3536
I did make the animation myself and im not sure what the issue is I will probably just not include the tool in my game. Thanks for your help though
You need the Overdrive goggles in order to fix that
 

WizardOfHills

Active Member
Jul 21, 2018
254
48
28
Roblox
WizardOfHills
I just had a similar problem and figured it out. My problem was that I did not set priority for the animation. When I specified "Action" priority, it miraculously started to work.