How to make view model do play an animation

I tried to play animation but script is broken now how can make view model do play an animation

Heres script.
image


local ViewModel = game.ReplicatedStorage.ViewModel:Clone()



local hum = ViewModel:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(ViewModel.Equip)



RunService.RenderStepped:Connect(function()




	if Player.Character.Humanoid.Health == 0 then
		if Camera:FindFirstChild("ViewModel")~=nil then
			Camera.ViewModel:Destroy()

		end
	end

	if Camera:FindFirstChild("ViewModel")~=nil  then
		Camera:WaitForChild("ViewModel"):SetPrimaryPartCFrame(Camera.CFrame * CFrame.new(0.1, -2.5, -1) * CFrame.Angles(0.05, 0,0))
	end



	Character:FindFirstChild("KitsuneKatanaFE").Equipped:Connect(function()
		
		
		anim:Play()

end)


Change this to hum.Animator:LoadAnimation(ViewModel.Equip), Humanoid:LoadAnimation is deprecated.

If that doesn’t work, have you tried setting the animation’s priority in the Animation Editor to something lower in the list (the lower it is in the list, the higher priority it is)?

Inserting a WorldModel in the ViewportFrame, and putting your viewmodel inside of it, might help.

Its deprecation doesn’t mean it no longer works.

The issue is likely regarding the animation’s ownership/priority.

I’m not saying it doesn’t work, but even if it does it doesn’t mean you should use it, like you shouldn’t use Mouse.KeyDown, which technically works, with it’s massive input delay.