Animation Control

I’ve seen many posts related to this topic, however non seem related to what I’m trying to do. Currently, I have an NPC who walks, stops, and then walks again. However, when it walks and stops the first time, the animations load both client and server-side. After the NPC is done standing it moves again, then the animation goes to a “blank” on the client-side, however the server-side, it works perfectly fine.

The script is located inside the NPC, it’s also a server script, not a local script.

function MoveAnimation()
	wait(.1)
	local animation = Dummy.Animation
	animation.AnimationId = "rbxassetid://507777826"
	local trackanimation = Dummy.Humanoid:LoadAnimation(animation)
	trackanimation:Play()
end

function IdleAnimation()
	wait(.1)
	local animation = Dummy.Animation
	animation.AnimationId = "rbxassetid://507766666"
	local trackanimation = Dummy.Humanoid:LoadAnimation(animation)
	trackanimation:Play()
end```
1 Like

Try moving the animation to the client and see if it works.

I’m not too sure what is causing this issue but that seems like a possible solution.

1 Like

Animations can overwork the server and to reduce the server’s workload i would recommend you do the moving on the server and fire a remote event to all client to play the animation locally.

2 Likes

I’d recommend to use localscript

hum.Running:Connect(function(speed)
 if speed > 0.1 then
  moveTrack:Play()
 else
  idleTrack:Play()
 end
end)

idleTrack:Play()

Npcs walk.rbxl (24.6 KB)

2 Likes

Thanks, I’ll test this out very shortly.