How to run VIewModel animation?

so i try to Run ViewModel animation but for some reason it wont run idk if it because of my script or my ViewModel it doesnt have any error i try remake my code many time and it still wont run


here my Script if you guy wonder if i do anything wrong :

local tool = script.Parent
local Handle = tool.Handle
local player = game.Players.LocalPlayer
local Char = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()

local VM = nil

local Runservic=game:GetService("RunService")
local Uis=game:GetService("UserInputService")

local Camera = workspace.CurrentCamera
local Head = Char:WaitForChild("Head")

local Connection = nil
local track = nil
local clickConnection = nil
local ANIMATION_ID = "rbxassetid://117944723150421"

local function TranparencyTool(Num)
	for _,v in pairs(Handle:GetChildren())do
		if v:IsA("BasePart") or v:IsA("MeshPart") then
			v.LocalTransparencyModifier = Num
		end
	end
end


tool.Equipped:Connect(function()
	VM = game.ReplicatedStorage:WaitForChild("VM"):WaitForChild("VM.3"):Clone()
	local hum = VM:WaitForChild("Humanoid", 5)
	local Animator = hum:WaitForChild("Animator", 5)
	
	if Animator then
		local animObj = Instance.new("Animation")
		animObj.AnimationId = ANIMATION_ID
		track = Animator:LoadAnimation(animObj)
	end
	clickConnection = mouse.Button1Down:Connect(function()
		print("click")
		if track then
			track:Play()
			print("play")
		else
			warn("Animation track is not loaded!")
		end
	end)
	
	Connection = Runservic.RenderStepped:Connect(function()
		local distand = (Head.Position - Camera.CFrame.Position).Magnitude
		
		if distand <= 1.5 then
			VM.Parent = Camera
			VM:PivotTo(Camera.CFrame)
			TranparencyTool(1)
			--print("is active")
			
		elseif distand >= 1 then
			TranparencyTool(0)
			VM:PivotTo(CFrame.new(0,-50,0))
		end
	end)
	
end)

tool.Unequipped:Connect(function()
	if Connection then
		Connection:Disconnect()
		Connection = nil
		clickConnection:Disconnect()
		clickConnection = nil
		VM:Destroy()
	end
end)

you have both Humanoid and AnimationController, they conflict.
Remove AnimationController, I guess, since you code uses Humanoid.

also please use
image
to insert code

-- you code here

.

thx you for your Suggest and i try delete nimation controller but it still not working

running animations directly off the humanoid has been depreciated, hence why there is an animation controller.

good, you have some prints there.
could you please share the output?
thanks!

So in order to get an animation on a humanoid to play in a viewport a frame you need a WorldModel, put the WorldModel inside of the viewport frame and then parent your character to be inside of the WorldModel. make sure you update your script to correctly reference the new locations of your character and whatnot

parent VM to Camera before loading animations.