So I made a script that plays a equip animation then after the equip is done the idle animation stars playing. But if the player equips the tool then unequips before the idle starts playing the idle animation plays anyway even without holding the tool? this is the script that plays:
script.Parent.Equipped:Connect(function()
if not broken then
Equip:Play()
Equip.Stopped:Wait()
Idle:Play()
equipped = true
else
plr.Character.Humanoid:UnequipTools()
end
end)
then this is the script that stops:
script.Parent.Unequipped:Connect(function()
for i, track in pairs(script.parent.parent.parent.Character.Humanoid:GetPlayingAnimationTracks()) do
track:Stop()
end
equipped = false
end)
You could do a if statement to check if the player is still equipping the tool after the equip animation is done. If they unequip, just return or break the thread.
In the script that stops the animation, I think you put “parent”, instead of “Parent”, when you looped through the tracks. I think “parent” is deprecated.
You can just wait for it to be unequipped instead of making a new connection.
Tool = script.Parent
Tool.Equipped:Connect(function()
if not broken then
Equip:Play()
--Equip.Stopped:Wait() / May want to look into reconfiguring this Equip should have animation priority of Action to work
Idle:Play() -- Idle should have animation priority of Idle Equip overrides idle and thread is not paused
Tool.Unequipped:Wait()
Equip:Stop()
Idle:Stop()
else
plr.Character.Humanoid:UnequipTools()
end
end)
I usually come accross many unnecessary connections like these. Sometimes keeping things linearly is a lot easier that tracking statuses with variables everywhere.
What I meant is once the equip animation is done playing, you make an if statement to check if the player is still holding the tool. If it is, do the idle animation. If not, then stop Thebes animation.