Animation not playing through worldmodel in viewport frame

I’m trying to play an animation on a rig inside a worldmodel parented to a viewportframe. The problem is there are no errors and it seems like it should be working correctly, here is my code:


for i, sequence in pairs(animationSequences.animations) do
	local newButton = storage.get("animationButton", frames.animationGui.ScrollingFrame)
	newButton.Name = i	
	newButton.TextLabel.Text = (#i < 13 and i) or string.sub(i, 1, 12)..".."
	
	local anim = Instance.new("Animation", newButton.ViewportFrame.WorldModel)
	anim.AnimationId = "rbxassetid://"..tostring(sequence)
	
	
	local rig = storage.get("rig", newButton.ViewportFrame.WorldModel)
	local loaded = rig.Humanoid.Animator:LoadAnimation(anim)
	loaded.Looped = true
	loaded:Play()
	

	
	local cam = Instance.new("Camera", newButton.ViewportFrame.WorldModel)
	cam.Name = "CurrentCamera"
	cam.CFrame = rig.HumanoidRootPart.CFrame - Vector3.new(0, 0, -5)
	newButton.ViewportFrame.CurrentCamera = cam
	
end


Solved (The rigs were anchored)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.