Idle animation for tool plays on other tools aswell

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

yeah, I tried playing it with ā€œ0ā€ which was the original value of toolnone, but it still played on other tools.

When you mean 0, what do you exactly mean, did you changed the id inside the script? The one with rbxassetid?

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.

Use the standard Roblox Idle Animation ID for anything other than that one tool.

You may actually want to read the AnimationTrack documentation that @lamcellari posted to figure out how to use Animation.

2 Likes

Nevermind, I’ve hired someone to make an idle animation script for me, I’ll post the full thing when he gives it to me.

That seems a bit extreme.
The Roblox idle animation is free and is probably already set up as the default animation if you haven’t changed it.

Sir, I don’t mean to be rude, but can you read my post again?

Just to change the idle animation of the player, while using the tool you mean? Can you provide more context?

I did read it.

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.

So how can I stop all the animations?

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.

This code should fix the problem…

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)
1 Like

Yes, I did.

Characters of the thirty

Hm, I’ll try that out later. I hope it works!

Hm, it didn’t work, still has the same problem.

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.

Yeah I read it but I wasn’t actually paying attention, I’m so sorry sir.

I was in class lol and the teacher told us to put our phones down, uh I’ll try it 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.

I’ll try that, I didn’t reply for a long time lol