Animation playing differently when played on local script vs server script

Hello everyone, I’m currently having a minor issue. When playing a looped run animation from a local script, it plays and weirdly and doesn’t seem to be working right. However when I use the (almost) exact same code on a server script, it works just fine.

Server script inside NPC model:

local Mob = script.parent
local Humanoid = Mob.Humanoid
local RunAnimObject = Mob.Animations.RunAnimation
local RunAnimTrack = Mob.Humanoid.Animator:LoadAnimation(RunAnimObject)
task.wait(2)
RunAnimTrack:Play()

Local script inside StarterPlayerScripts:

local Mob = game.Workspace:WaitForChild("SoldierAlly")
local animations = Mob.Animations
local RunAnimObject = Mob.Animations.RunAnimation
local RunAnimTrack = Mob.Humanoid.Animator:LoadAnimation(RunAnimObject)
RunAnimTrack:Play()

Theres nearly no difference in code, but the animations play completely different.

Animation playing when played from a server script:

Versus animation playing when played from a local script (Inside starterplayerscripts):


Another thing I’ve noticed is that the animation played from the local script plays wrong for a while as you can see, but after about 30-40 seconds it starts playing correctly. I’ve no idea why this is happening
I’ve already made sure that the server script isn’t active when the local one is, so there’s no script interaction causing this behaviour.

Any idea what might be causing this? Thanks!

I’ve no idea what would cause that. It looks like the Torso’s Motor6D is not being animated when the animation is played on the client.

local RS = game:GetService("RunService")

local mob = -- mob location

local isPlaying = false
RS.RenderStepped:Connect(function(dt)
	local ip = mob.HumanoidRootPart.RootJoint.Transform==CFrame.identity
	if ip~=isPlaying then
		isPlaying = ip
		print(isPlaying)
	end
end)

Try running this on the client to see if the Torso is being animated.

1 Like

I got an error saying: "RootJoint is not a valid member of Part “Workspace.SoldierAlly.HumanoidRootPart”. I replaced “RootJoint” with “Torso” and it printed this:

I think that might be happening because of the “Animate” script inside said character overriding the animation

Theres no “Animate” script inside the model, only the ones inserted by me

I’ve just discovered that if I wait 45+ seconds before playing the animation on client side, it starts off playing correctly and keeps playing correctly. Maybe its some sort of synchronization issue between the client and server?

1 Like