Hello! This is my first post so please ignore the mistakes…
I am making a tool that plays an animation once you equip and stops when you unequip.
When you equip it works perfectly but when I unequip the animation still plays. There are no errors in the output either so I’m pretty much lost.
https://gyazo.com/75f04c6b3bfa7ae435dea227ea23b2bc
This is my script right now.
local Idle = script.Parent.Idle
local Eat = script.Parent.Eat
local Tool = script.Parent
script.Parent.RemoteEvent.OnServerEvent:Connect(function()
local EatAnimTrack = Tool.Parent.Humanoid:LoadAnimation(Eat)
EatAnimTrack:Play()
end)
script.Parent.Equipped:Connect(function()
local IdleAnimTrack = Tool.Parent.Humanoid:LoadAnimation(Idle)
IdleAnimTrack:Play()
end)
local Idle = script.Parent.Idle
local Eat = script.Parent.Eat
local Tool = script.Parent
script.Parent.RemoteEvent.OnServerEvent:Connect(function()
local EatAnimTrack = Tool.Parent.Humanoid:LoadAnimation(Eat)
EatAnimTrack:Play()
end)
script.Parent.Equipped:Connect(function()
local IdleAnimTrack = Tool.Parent.Humanoid:LoadAnimation(Idle)
IdleAnimTrack:Play()
end)
script.Parent.Unequipped:Connect(function()
local IdleAnimTrack = Tool.Parent.Parent.Character.Humanoid:LoadAnimation(Idle)
IdleAnimTrack:Stop()
end)
script.Parent.Unequipped:Connect(function()
local IdleAnimTrack = Tool.Parent.Parent.Character.Humanoid:LoadAnimation(Idle)
IdleAnimTrack:Stop()
end)
Any help will be greatly appreciated! Thank you!