I’m trying to tween the orientation of a model, which is a spotlight, but I have no idea how to do it and all of the tutorials I found were too confusing for me. Here is one of them I tried to understand:
Try welding the parts together so when you tween the primary part, the other parts are going to follow. If that doesn’t work you can use SetPrimaryPartCFrame() and figure out the CFrame.
If your model is moving like that then either you haven’t welded the model together properly or one of the parts there is still anchored considering it’s not moving around with the lamp base. I’ve tried to simplify the information as much as I could there: what confuses you about the tutorial?
Adequate programming knowledge is recommended to understand that tutorial, so if you lack that, it could be another cause for not understanding the tutorial, but I’m interested in knowing from your perspective where you don’t understand that tutorial.
Some information about your model setup would be appreciated as well.
There’s code in the tutorial that supplies a way to weld your model together with WeldConstraints so that you don’t have to puzzle over this work yourself if you aren’t familiar with it. It is under the Attaching the Model header. That part it seems you skipped over.
If your spotlight model is directly in the workspace, then you can use the code there but change Panel to Spotlight in the first variable declaration, remove the CanCollide = false bit at the end and run that. It will rig your model up itself by welding the model and then setting Anchored accordingly.
Tweening the PrimaryPart then should also have the other parts follow in suit.
It isn’t working for some reason, I’ve followed your steps but it still does the same thing it did before. It does add the WeldConstraints, it just doesn’t do anything. Maybe it’s because of the script? Here it is:
local TweenService = game:GetService("TweenService")
while true do
wait(1)
local Main = script.Parent.PrimaryPart
local goal = {}
goal.Orientation = Vector3.new(math.random(-10,14),math.random(23,70), math.random(16,43))
local tweenInfo = TweenInfo.new(0.5)
local tween = TweenService:Create(Main, tweenInfo, goal)
tween:Play()
end
local TweenService = game:GetService("TweenService")
while true do
wait(1)
local Main = script.Parent.PrimaryPart
local goal = {}
goal.CFrame = Main.CFrame * CFrame.fromOrientation(math.random(-10,14),math.random(23,70), math.random(16,43))
local tweenInfo = TweenInfo.new(0.5)
local tween = TweenService:Create(Main, tweenInfo, goal)
tween:Play()
end
Sorry for asking so much, but I’m not experienced with CFrame at all. In fact, I just started using it.
In this case, it’s just about playing around with the values a bit until you can find a sweet spot that you like. The CFrame bit is a little different from Orientation so extreme values like that might appear. Feel free to plug in any numbers there.
(I’m not too good with CFrames either, just basics.)