Animation not playing

So I am trying to make an animation play at the end of a cutscene. I fire a remote event to the inside of the non-humanoids model.

Local script

game.ReplicatedStorage.Animation:FireServer()

Server script

local rig = script.Parent

game.ReplicatedStorage.Animation.OnServerEvent:Connect(function()
	local kickAnimation = Instance.new("Animation")
	kickAnimation.AnimationId = "rbxassetid://8579694972"

	local animController = Instance.new("AnimationController")
	animController.Parent = rig
	local animator = Instance.new("Animator")
	animator.Parent = animController

	local kickAnimationTrack = animator:LoadAnimation(kickAnimation)
	print("playing")
	kickAnimationTrack:Play()
end)

Animation is set to action. Anybody know?

You can preput the animation into a humanoids animator in the NPC (or whatever you’re using) and then just do something like this.

game.ReplicatedStorage.Animation.OnServerEvent:Connect(function()
	local humanoid = game.Workspace.Dummy.Humanoid
	local Animator = humanoid.Animator
	local kickAnimation = humanoid.Animator.Animation -- change to what you want

	local kickAnimationTrack = Animator:LoadAnimation(kickAnimation)
	print("playing")
	kickAnimationTrack:Play()
end)

2 Likes