It’s set to core. Does it have to be set to idle?
No, I think that’s okay but it’s very possible that some other default roblox animations will overlap with yours, and if that’s the case then try disabling the default animation script before playing the idle (and then when its completed/not playing re-enable it). Also, yes @aaltUser is right, that’s probably the root of the problem. What you can do is take the code I gave you and then fix that small typo and that should work.
Your script still doesn’t work when I fixed the typo…
Edit: The issue is still the same, animation won’t loop and when I click the other animation for the spear doesn’t play. Also sorry for not being able to respond sooner…
This code has a few issues:
- You’re not supposed to loop animations like that
- Potential memory leak because you never delete the instances
For animations that are meant to be looped, there’s an option you enable in the animation editor: Animation Editor | Roblox Creator Documentation
If you want to manually loop it, you can do so like this:
animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7162716543"
slashAnimation = humanoid:LoadAnimation(animation)
animation2 = Instance.new("Animation")
animation2.AnimationId = "rxassetid://7162740569"
IdleAnimation = humanoid:LoadAnimation(animation2)
IdleAnimation.Looped = true
tool.Equipped:Connect(function()
IdleAnimation:Play()
end)
tool.Unequipped:Connect(function()
IdleAnimation:Stop()
end)
untested code
Ah ok. I set the animation to loop and I made this script, (Your script didn’t work.
local InputService = game:GetService("UserInputService")
local InputType = Enum.UserInputType
local animation = nil
local slashAnimation = nil
local animation2 = nil
local Idle = nil
tool.Equipped:Connect(function()
animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7162716543"
slashAnimation = humanoid:LoadAnimation(animation)
animation2 = Instance.new("Animation")
animation2.AnimationId = "rbxassetid://7172018535"
Idle = humanoid:LoadAnimation(animation2)
Idle:Play()
end)
tool.Unequipped:Connect(function()
animation:Destroy()
slashAnimation = nil
animation2:Destroy()
Idle = nil
end)
Are you saying AnimationTrack.Looped=true
isn’t working?
If so, that might be an issue on Roblox’s end. Might be worthy of a bug report.
Also, it’s not a good idea to create a new animation object every time the tool is equipped. That could cause a memory leak.
EDIT: I guess you’re destroying it upon being unequipped
I forgot to make it looped=true. And it works now but the animation is being weird…
robloxapp-20210729-1149507.wmv (1.5 MB)
(Click open with movies and tv to watch)
The animation for the right arm doesn’t play, and when I walk the animation stops.
i set it to core…
that’s your problem
set it to idle
Ah ok cool.
Didn’t work. The hand holding the spear won’t play the animation and the animation won’t stop playing. Ex. When i unequip it it still plays the animation.
add IdleAnimation:Stop()
to your Unequipped event
And try increasing the priority
It works now! thank you so much!!!