I have the feeling that I am missing something really basic, but spent some time reading and trying things out and ended up nowhere… so hopefully you can throw some light.
What I want to do?
I have a 3d model character rendered on my UI, inside a ViewportFrame and I’m trying to keep this character rotating on the Y axis.
Here’s my code:
local classSelectionGUI = PLAYER_GUI:WaitForChild("ClassSelection")
local classOneViewport = classSelectionGUI.ClassContainer.ClassOne.Viewport
-- Class One Model
local classOneModel = REPLICATED_STORAGE.items.classes.class01:Clone()
classOneModel.PrimaryPart.Position = Vector3.new(0,0,0)
classOneModel.Parent = classOneViewport
-- Class One Camera
local classOneCamera = Instance.new("Camera")
classOneCamera.CFrame = CFrame.lookAt(Vector3.new(0,1,6), Vector3.new(0,0,0))
classOneViewport.CurrentCamera = classOneCamera
-- Class One Tween
local tweenOneConfig = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
local tweenOne = TWEEN_SERVICE:Create(classOneModel.PrimaryPart, tweenOneConfig, {Orientation = Vector3.new(0,360,0)})
tweenOne:Play()
The character renders as expected, but no tween seem to be happening since the character stay still.
One thing that I noticed when I was trying to better position my character (model) is that the line:
I just did it, and it noticed that now my character is playing idle animation, which is great… you solved a problem I would have ahead, so thanks for that.
The Tween still not happening though
EDIT: Also noticed that now I can position my character (model) with the line that previously wasn’t working.
local classSelectionGUI = PLAYER_GUI:WaitForChild("ClassSelection")
local classOneViewport = classSelectionGUI.ClassContainer.ClassOne.Viewport
-- Class One Model
local classOneModel = REPLICATED_STORAGE.items.classes.class01:Clone()
classOneModel.PrimaryPart.Position = Vector3.new(0,0,0)
classOneModel.Parent = classOneViewport
-- Class One Camera
local classOneCamera = Instance.new("Camera")
classOneCamera.CFrame = CFrame.lookAt(Vector3.new(0,1,6), Vector3.new(0,0,0))
classOneViewport.CurrentCamera = classOneCamera
-- Class One Tween
spawn(function()
while task.wait(0.001) do
local ModelCFrame = classOneModel:GetPrimaryPartCFrame()
ModelCFrame *= CFrame.Angles(0,0.05,0)
classOneModel:SetPrimaryPartCFrame(ModelCFrame)
end
end)