Idle animation for tool plays on other tools aswell

  1. What do you want to achieve? Keep it simple and clear!
    I want to fix my idle animation system for my tool.
  2. What is the issue? Include screenshots / videos if possible!
    The idle animation plays when I use other tools without idle animation scripts, the only time the idle animation stops is when I unequip whatever tool I have.
    robloxapp-20250116-1630362.wmv (372.3 KB)
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried changing the animation priorities of different things, this (the idle animation) is set to “Idle” and everything else tool related is “Action”. I guarantee that the idle animation is NOT core, as I have uploaded many different versions to Roblox.

Here’s the idle animation code, I got it off someone else, and they didn’t leave any comments, so this script is kind of confusing for me :sweat_smile:

local Tool = nil 
local animScript = nil
script.Parent.Equipped:Connect(function()
	Tool = script.Parent
	animScript = Tool.Parent:WaitForChild("Animate")
	animScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
	animScript.toolnone.ToolNoneAnim.AnimationId = "rbxassetid://85680571457660"
	
end)
script.Parent.Unequipped:Connect(function()
	animScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
	animScript.toolnone.ToolNoneAnim.AnimationId = "rbxassetid://85680571457660"
end)

Any help would be appreciated, because this is kind of gatekeeping me in my tool system. :sweat_smile:

4 Likes

Interesting script you got there but you can just call :Stop() on an animation track to stop it.

1 Like

The more simple way of cancelling the animation would be to use :Stop() as Redston_block180 stated, on the AnimationTrack. It should cancel all current animations, aside from the default roblox animations.

2 Likes

Hm, I never thought of that actually, I’ll try it later. Hope it works.

1 Like

I’m not sure there’s a way to to say :Stop(). what I have tried is to rewrite the idle script with no avail, can anyone help?

Do you or the other person have any ideas?

In the Unequipped function in the script you have to reference the animation that’s running and .Stop it there.

If you want this idle animation to play with only one tool then in the Equipped function put an if check in there to see which tool was equipped. If it’s the tool that needs the animation then play the animation.

So how would I stop the toolnone?

I think however, that I need to rewrite the script in such a way that it plays an animation as long as equipped, without the toolnone crap, but I have already tried that to no avail. Does anyone have a spare idle animation script from a game they made that works? Thanks

If you stop the animation when the specific tool is unequipped then it should work. I think the standard idle animation should run then, but if not then play the standard idle animation.

2 Likes

How can I reference the animation in the script?

I also tried to do the stuff you wanted:

local Tool = nil 
local animScript = nil
script.Parent.Equipped:Connect(function()
	Tool = script.Parent
	animScript = Tool.Parent:WaitForChild("Animate")
	animScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
	animScript.toolnone.ToolNoneAnim.AnimationId = "rbxassetid://85680571457660"
end)
script.Parent.Unequipped:Connect(function()
	-- neither of these methods work, and i tried switching them around aswell
	animScript.toolnone.ToolNoneAnim:Stop()
	animScript:Stop()
	animScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim"):Stop()
	
	----------------------------------------------------------------------------
	
	animScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
	-- i changed the toolnoneanim's ID, but it still didnt work :[
	animScript.toolnone.ToolNoneAnim.AnimationId = "rbxassetid://0"
end)

It still didn’t work.

This is why I was asking for people to post some idle animation code from previous games they made.

Just making sure your tool anims id isnt the same right?

What do you mean by the anims id?

Are you sure that the animations id are not the same? Each animation requires an id in order to play

Uh, yeah, its fine, I have the correct ID and it works

Yeah but what about the other ids? Are they the same? If so it would makes sense

Yeah, the other ID’s are the same I think, Provide me with more context?

BTW, do you have an idle animation from any games you made in the past, if so, it would help tremendously with a working version :grinning: