Rotating an object inside a viewport frame

I’m so confused on what I am doing wrong, I got no errors and I did a print saying “Works”. It got printed out.

while wait() do
	if skinScrollingFrame:FindFirstChild("SkinFrame") then
		for i, v in pairs(skinScrollingFrame:GetChildren()) do
			if v:FindFirstChild("SkinPicture") then
				for x, s in pairs(v.SkinPicture.ViewportFrame:GetChildren()) do
					if s:IsA("Model") then
						for deg = 0, 360, speed do
							s.PrimaryPart.Rotation = Vector3.new(0, deg, 0)
						end
					end
				end
			end
		end
	end
end

I found out how, but if there’s other ways let me know

while wait() do
	if skinScrollingFrame:FindFirstChild("SkinFrame") then
		for i, v in pairs(skinScrollingFrame:GetChildren()) do
			if v:FindFirstChild("SkinPicture") then
				for x, s in pairs(v.SkinPicture.ViewportFrame:GetChildren()) do
					if s:IsA("Model") then
						s:SetPrimaryPartCFrame(s:GetPrimaryPartCFrame() * CFrame.fromEulerAnglesXYZ(0, -0.04, 0))
					end
				end
			end
		end
	end
end
1 Like

You should probably put that in a renderstepped since I don’t think while wait() do is reliable.

Also, rotating the camera is more viable if it is the only thing in the viewport.