So, every animation has their own unique of ID, its how roblox play the animation. If you play the animation with the same id, it will do the same animation, if you want to play a different animation you need their respective id
You can put the ids in the script or create an animationtrack
I mean, I changed the id for the unequipped section, cos in the players animate, thereās something called ātoolnoneā and it has a default ID of 0, and as you can see in the revised script somewhere above, I set it to zero, so it wouldnāt play on other tools, but it did.
Your complaint was that your idle animation was playing with all your tools enabled, not just the one you wanted it for.
The solutions Iāve suggested seem like a pretty easy fix:
Play your animation only when the special tool that requires it is equipped.
If a different tool is equipped then donāt play any animation, just keep the standard Roblox animations (idle included).
If the special tool is unequipped simply stop your animation. If the Roblox idle animation doesnāt automatically play after that then find the Roblox idle animation number and play it.
Find the animation track numbers and stop them all.
Did you read up on the AnimationTracks documentation as we already mentioned above, specifically GetPlayingAnimationTracks? It tells you exactly how to stop playing all running animations.
local Tool = nil
local animScript = nil
local idleAnim = nil
script.Parent.Equipped:Connect(function()
Tool = script.Parent
animScript = Tool.Parent:WaitForChild("Animate")
local toolNone = animScript:WaitForChild("toolnone")
idleAnim = toolNone:WaitForChild("ToolNoneAnim")
idleAnim.AnimationId = "rbxassetid://85680571457660"
for _, tool in pairs(Tool.Parent:GetChildren()) do
if tool:IsA("Tool") and tool ~= script.Parent then
if tool:FindFirstChild("Animate") then
local otherAnimScript = tool:WaitForChild("Animate")
local otherToolNone = otherAnimScript:WaitForChild("toolnone")
local otherIdleAnim = otherToolNone:FindFirstChild("ToolNoneAnim")
if otherIdleAnim then
otherIdleAnim:Stop()
end
end
end
end
end)
script.Parent.Unequipped:Connect(function()
if idleAnim then
idleAnim.AnimationId = "rbxassetid://85680571457660"
idleAnim:Stop()
end
end)
Ok, you say you read the documentation but I canāt see a notification that you clicked the link I put in my post to show which section I was referring to.
That section of the documentation gives you a sample script that will stop all animations. From what you were asking it seems that that should have helped you out.
You indeed have to use :Stop() but on the loaded animation. Somewhat like DEINCREDIBLEHULK.Humanoid.Animator:LoadAnimation(āYOUR ANIMā):Stop(). Most examples used :Stop() on the AnimationTrack itself.
Of what Iāve seen, you use another script to play the animation. Is it client-sided? Use an event to make it stop playing the animation, or make it stop every animations while unequipping and you should be good to go.