Animation for custom rig working in animation editor but not in-game

I’ve created a custom rig and animated it in the animation editor, but when I try to test it in the studio it doesn’t work while it works in the animation editor, I’m testing it through a server script and here is the structure:
image
image
It logs “PLAYED ANIMATION” but it never plays, here is how it looks like in studio and in plugin:
image
Plugin:


Animation priority is set to action and the animation is 3 seconds long and looped, only the main part of the rig is anchored, all other parts are unanchored and collision disabled

1 Like

I’m not going to pretend to be experienced in animations, but judging by the fact that your animation is a gun hold, and its 6 seconds long (maybe shorter?), did you loop it?

If you haven’t looped the animation before playing or (or didn’t loop it in the editor), then it won’t work.

Secondly, a brief thing. script:WaitForChild(“Animation”) and script.Parent:WaitForChild(“Humanoid”) are a bit redudent. In my experience even if you have streaming enabled on, these parts won’t be affected to begin with as there is no need to stream them (due to their non visualness). Use FindFirstChild() for them instead. That’s just my advice.

Let me know if the loop thing was the issue.

The animation is looped and its just 3 seconds, and for the WaitForChild() part I’m going to make the script local later

Are you sure that the animation priority is set to action? Open up your animation in the anim editor and set the animation priority to Action, the option comes up when you click these three dots in the corner.


Then export it over the old animation.

Edit: My bad, I didn’t read your post thoroughly enough.

Alright. Then the next problem might be, is your animation actually uploaded to the site?

If so, go to the site and grab that ID and paste it into the animation.

This code should work. I don’t think you need the Animator if you are loading the animation, so try also removing that.

Yes the animation priority is set to action and shouldn’t that have an effect only if there were other animations playing? This is the only animation being played on that rig

The animation is uploaded to the site check the structure image I attached, I’m getting no errors in output

Might be a dumb idea, but try moving the animation outside of the script and try that. Perhaps the animation needs to be in a physical object rather than a script.

Just tried putting it in the Humanoid and in the model but both didn’t work

Not sure if this helps, but maybe convert it to a LocalScript?

Here is an idea for testing. If you view the API, you’ll find a lot of fun tricks.

Try using:

LoadingAnim.DidLoop:Connect(function()
print("I LOOPED!")
end)

This should tell you if the track is properly playing and looping. If that doesn’t print, it is obviously not looping.

It’s not printing, that probably mean the animation isn’t playing at all because I tried waiting 5 seconds before playing and nothing happened, the script is saying the animation is playing but I don’t see it playing
image

local Animation = script.Parent.Humanoid:WaitForChild("Animation")
local Humanoid = script.Parent:WaitForChild("Humanoid")
local LoadedAnim = Humanoid:LoadAnimation(Animation)

LoadedAnim.DidLoop:Connect(function()
print("I LOOPED!")
end)

LoadedAnim:Play()

print(LoadedAnim.IsPlaying)
print("PLAYED ANIMATION")

Do local scripts work in workspace?

This is incorrect. Workspace is both a server and client sided service. If it was strictly a server-sided service the roblox engine wouldn’t run.

@rokoblox5 I recommend trying to do LoadedAnim.Looped = true or something of similar variant (cannot remember exactly how to do it). Perhaps it is truly not looped?

Didn’t work, I tried putting that line after and before playing the animation but none worked

Switching from a Humanoid to an AnimationController worked but I had to redo the animation in the animation editor, the animation is playing but with incorrect easing direction, styles or wrong timing and I’m trying to fix it

EDIT: Issue fixed, thanks to this post Issue with animation playing only with keyframes with cubic easing style

1 Like