My animation isn't running

im trying to make a viewmodel and when i try to run the animation through script, it refuses to run. any help is appreciated!

local player = game.Players.LocalPlayer
local char = player.Character
local cam = workspace.Camera
local run = game:GetService("RunService")
local arms = game.ReplicatedFirst.DeagleViewModel:Clone()
local MyGun = script.Parent
local GunHandle = MyGun:WaitForChild("Handle")
arms.Parent = cam

MyGun.Equipped:Connect(function()

	local FPSARMS = game.Workspace.Camera:WaitForChild("DeagleViewModel")
	FPSARMS.LeftArm.Transparency = 0
	FPSARMS.RightArm.Transparency = 0

	GunHandle.Transparency = 1

	local Humanoid = arms.Humanoid
	local Animation = arms.Animation
	local LoadAni = Humanoid:LoadAnimation(Animation)
	LoadAni:Play()

	local GunModel = FPSARMS.Deagle:GetChildren()

	for i, value2 in pairs(GunModel) do

		value2.Transparency = 0

	end

end)

if MyGun.Equipped then

	arms.Parent = cam

	run.RenderStepped:Connect(function()

		arms:SetPrimaryPartCFrame(cam.CFrame * CFrame.new(1,-2,-2.5) * CFrame.Angles(0,0,0))

	end)	
end

MyGun.Unequipped:Connect(function()

	arms.Parent = cam

	local FPSARMS = game.Workspace.Camera:WaitForChild("DeagleViewModel")
	FPSARMS.LeftArm.Transparency = 1
	FPSARMS.RightArm.Transparency = 1

	local GunModel = FPSARMS.Deagle:GetChildren()

	for i, value in pairs(GunModel) do

		value.Transparency = 1

	end

end)

Humanoid:LoadAnimation() is now deprecated. Use Animator, a child of a player’s Humanoid, Animator:LoadAnimation instead.

1 Like

what should i put instead of what i already have? ive been trying to use Animator but im completely stumped

What do you mean by this? Can you be more specific?

nevermind my issue wasnt in the script my animation was broken