Viewmodel not playing animation

I want my viewmodel to play animations, however it just doesn’t seem to work.
https://gyazo.com/5f308c20d43be1cca9b5d48d4c9cfcc4
There are no relevant errors to the animations in console


(ignore the other errors, it works just fine but the console is all waah-waah)
I can confirm that both of the animations in the script are owned by me.

local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

--local gunModel = game.ReplicatedStorage.Fists

local gunTool;

local camera = workspace.CurrentCamera
local cframeOffsetFromCamera = CFrame.new(0, -2, -1) -- change this offset to fix where you want


local function cframeToCamera()
	while gunTool and game:GetService("RunService").RenderStepped:Wait() do
		gunmodelclone.Parent = camera
		gunmodelclone:SetPrimaryPartCFrame(camera.CFrame * cframeOffsetFromCamera)
		gunmodelclone.HumanoidRootPart.Anchored = false
		armhumanoid = gunmodelclone:FindFirstChild("Humanoid")


	end
end

char.ChildAdded:Connect(function(child)
	if child:IsA("Tool") then
		gunTool = child
		--print(child.Name.."This is the child")
		gunModel = game.ReplicatedStorage[child.Name]
		--print(gunModel.Name.."This is the gunModel")
		gunmodelclone = gunModel:Clone()
		cframeToCamera()
		equip = gunmodelclone:WaitForChild("Equip")
		idle = gunmodelclone:WaitForChild("Idle")
		eanim = armhumanoid:LoadAnimation(equip)
		ianim = armhumanoid:LoadAnimation(idle)
		wait()
		ianim:Play()
		eanim:Play()
	end
end)

local function cFrameBack()
	gunmodelclone:Destroy()
end

char.ChildRemoved:Connect(function(child)
	if gunTool and child == gunTool then
		cFrameBack()
		gunTool = nil
	end
end)

I’ve noticed another user having this issue and he still has not been replied to.

What is preventing the animations from playing?

The while loop is yielding and preventing the animation lines from being played. Use task.spawn or coroutine.wrap to bypass this.

I will try it out tomorrow, I’m burnt out for now as it’s almost 3 am. Thanks!