Touble with playing animations in viewportframe

Im trying to get my animation to play inside the viewportframe. I’m using world model and if I parent the rig to the workspace the animation will play, therefore I’m assuming Im using worldmodel / viewportframe incorrectly.

local function createAnimationPages()
	local maxSlotsPerPage = #SlotPage:GetChildren()
	local pageIndex = 1

	-- Create pages and populate with animations
	for i = 1, #animations, maxSlotsPerPage do
		local newPage = SlotPage:Clone()
		newPage.Name = "Page"..pageIndex
		newPage.Visible = true
		newPage.Parent = Slots
		table.insert(pages, newPage)

		-- Fill the page's slots with animations
		for j = 1, maxSlotsPerPage do
			local slotIndex = i + j - 1
			local slot = newPage:FindFirstChild("Slot"..j)
			local animation = animations[slotIndex]
			
			if animation then
				local danceName = animation.Name

				local newViewport = Instance.new('ViewportFrame', slot)
				newViewport.BackgroundTransparency = 1
				newViewport.Size = UDim2.new(1, 0, 1, 0)

				local worldModel = Instance.new('WorldModel')
				local newRig = Rig:Clone()
				local cFrame, size = newRig:GetBoundingBox()
				newRig.Parent = workspace
				
				local anim = Instance.new('Animation')
				anim.AnimationId = animation.AnimationId

				local humanoid = newRig:FindFirstChildOfClass("Humanoid")
				if humanoid then
					local loadAnimation = humanoid:LoadAnimation(anim)
					loadAnimation.Looped = true
					loadAnimation:Play()
				else
					warn("No Humanoid found in rig.")
				end
				
				newRig.Parent = worldModel
				worldModel.Parent = newViewport
				
				local newCamera = Instance.new('Camera')
				newCamera.Parent = newViewport
				newViewport.CurrentCamera = newCamera

				-- Camera adjustment to fit the model inside the ViewportFrame
				local distance = (size.Magnitude * 0.5) / math.tan(math.rad(newCamera.FieldOfView * 0.5))
				newCamera.CFrame = CFrame.new(cFrame.Position) 
					* CFrame.fromEulerAnglesYXZ(math.rad(-20), math.rad(20), 0) 
					* CFrame.new(0, 0, distance)

				slot:SetAttribute('Dance', danceName)

				slot.MouseButton1Click:Connect(function()
					print("Selected Dance:", danceName)
				end)

				-- Set hover effects to display dance name
				slot.MouseEnter:Connect(function()
					local danceName = slot:GetAttribute('Dance')
					SelectionText.Text = danceName

					local effect = hoverEffects[slot.Name]
					if effect then
						SelectionEffect.Rotation = effect.rotation
						SelectionGradient.Rotation = effect.rotation
					end
				end)
			else
				slot:SetAttribute('Dance', "No Animation")
				slot.Visible = false
			end
		end

		pageIndex = pageIndex + 1
	end
end