im trying to continuously rotate my model in a viewport frame but it only rotates the primary part. i welded and anchored all my model together. i also set the primary part of the model too.
code:
function module.shopThumbnails()
local p = game.Players.LocalPlayer
local plrGUI = p.PlayerGui
local shop_UI = plrGUI.shop_UI
local shop_frame = shop_UI.shop_frame
local caterpillars_folder = shop_frame:WaitForChild("caterpillars_folder")
local caterpillar_head = game.ReplicatedStorage:WaitForChild("caterpillar_head")
local caterpillar_heads = {}
for _, caterpillar_vpf in pairs(caterpillars_folder:GetDescendants()) do
if caterpillar_vpf:IsA("ViewportFrame") then
local worldModel:WorldModel = caterpillar_vpf:FindFirstChild("WorldModel")
local cam:Camera = Instance.new("Camera", caterpillar_vpf)
caterpillar_vpf.CurrentCamera = cam
local caterpillar_headClone = caterpillar_head:Clone()
caterpillar_headClone.Name = "caterpillar_headClone"
caterpillar_headClone.Parent = worldModel
local caterpillarCF = CFrame.new(0,10,10) * CFrame.Angles(math.rad(-40),0,0)
caterpillar_headClone:PivotTo(caterpillarCF)
caterpillar_heads[caterpillar_vpf.Parent.Name] = caterpillar_headClone
end
end
local accumulatedRotation = 0
if connection == nil then
print(caterpillar_heads)
connection = rs.Heartbeat:Connect(function(dt)
for _, caterpillar in pairs(caterpillar_heads) do
if caterpillar:IsA("Model") then
caterpillar.PrimaryPart.CFrame = caterpillar.PrimaryPart.CFrame * CFrame.Angles(0, dt, 0)
end
end
end)
end
end