Animation Keeps On Stuttering/Restarting

When my NPC has an animation played on it while it moves, the animation stutters and it looks really bad. How should I go about fixing this?

Here is the animation script:

local Hum = script.Parent.Humanoid
local Swim = script.Swim
local SwimPlay = Hum:LoadAnimation(Swim)
Hum.Running:Connect(function()
if script.Parent.HumanoidRootPart.AssemblyLinearVelocity.Magnitude > 0 then
   SwimPlay:Play()
else
   SwimPlay:Stop()
end
end)

I haven’t scripted animations before, but I think a debounce might be able to fix the problem? If it doesn’t work, please correct me.

1 Like

I don’t think that’s the problem as even when I just set the animation to play all the time it still stutters.

Probably something to do with network ownership. Find out more here: Network Ownership | Roblox Creator Documentation

Here is a picture of the npc. (idk how to record pc screen)
Screenshot 2021-05-24 143029

This is something new to me, how would I do this for an animation?

Can skinned meshes have broken physics? I encountered a lot of other physical problems like it being able to bounce on the slightest bump in terrain.

No, it’s not just for you it also happens for me, I solve this in a bad way where I do it as a local animation and when I want it to play I use a remote event and fire it to all clients, this way the server doesn’t try and replicate any animation there for little lag/stuttering.

How do I fire animation to all clients?

No you fire a remote event, use this post to help: Bindable Events and Functions | Roblox Creator Documentation

I still have no clue. I’m new to remote functions and more advanced scripting.