I’ve spent hours the last few days trying to find a method to rotate the whole model in a tween (Bare in mind the model is also in a viewport if that matters). But instead the script only rotates the primary part.
local TweenService = game:GetService("TweenService")
local gamegui = Players.LocalPlayer.PlayerGui:WaitForChild("GameGui")
local finalframe = gamegui.FinalDiceFrame
local dice = finalframe.FinalDiceView.Dice
local face = roll.faces[math.random(1, #roll.faces)]
while dice.PrimaryPart.CFrame.Rotation == face.Rotation do
face = roll.faces[math.random(1, #roll.faces)]
end
local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local currentCFrame = dice.PrimaryPart.CFrame
local goalCFrame = currentCFrame * face
local goalModel = { CFrame = goalCFrame }
local tweenModel = TweenService:Create(dice.PrimaryPart, tweenInfo, goalModel)
tweenModel:Play()
--This is the role table stated above the code normally.
roll.faces = {
CFrame.Angles(0, math.rad(180), 0), -- Back
CFrame.Angles(0, math.rad(-90), 0), -- Left
CFrame.Angles(0, math.rad(90), 0), -- Right
CFrame.Angles(math.rad(-90), 0, 0), -- Top
CFrame.Angles(math.rad(90), 0, 0) -- Bottom
}