Tool Animation help

So Im having trouble with this tool animation, so basically im making a lightsaber idle animation, which is like when you hold the ligthsaber you are in like a attack pose animation, and im very new to scripting and i have been looking at tutorials to execute my goal, but when I tried to put the animation into the script, it excecutes the animation but then it reverts it back, so I need a bit of help with how to fix this problem.

1 Like

Have you looped the idle animation?

Not sure what you mean by looped animation.

Btw Heres the game link so you could get a better understanding of what im trying to do, ive already put the tool in the starter pack.
https://www.roblox.com/games/6917992530/Fight-people-with-big-glow-sticks

Ill give you an example:


local idleanim = Animator:LoadAnimation(idleanimation)

idleanim.Looped = true

I hope this makes sense

Where do I input this? And also is this local script or just normal?

Mind me seeing the part of the script that runs the animation?

It works for both local scripts and normal scripts

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 = “https://roblox.com/asset/?id=7176674900”

end)

script.Parent.Equipped:Connect(function()

Tool = script.Parent

animScript:WaitForChild(“toolnone”):WaitForChild(“ToolNoneAnim”)

animScript.toolnone.ToolNoneAnim.AnimationId = “https://roblox.com/asset/?id=7176674900”

end)

These are my animations that I have added in.

wait it looked very different from the other scripts i have seen on the dev forum, like what I am saying is the color. Do you know how i can fix this?

You could puy this in after you made a variable for the animation:

local Animation = script.animation
local animationtrack = (players humanoid).Animator:LoadAnimation(Animation)
animationtrack.Looped = true

Sorry if there are any typos I was writing this on my phone.

It says these animations dont exist anymore.

hmmmmm it also says that for me

heres the animation

Wait how do you like make the looped script look like that like it has a diff color than the script that I posted(on the dev forum btw)

And Im having trouble when you said that I should input the script after I made a variable for the animation.

Would this work?


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 = “https://roblox.com/asset/?id=7176674900”
local animtrackplay = script.Parent.Parent.Humanoid:WaitForChild("Animator"):LoadAnimation(animScript.toolnone.ToolNoneAnim)
animtrackplay.Looped = true
animtrackplay:Play()
end)


1 Like

It works thanks for the help. And have a good day

1 Like

Aww man its not working again but I can fix it.