I was wondering how could I change the orientation of a model. I’ve looked on some of them and they just make no since to me and either never get solved. I was looking if theres anything I could do to change it. I know you could do something with the PrimaryPart.
you can manipulate the pivot of the model to change it’s orientation
local Model = workspace.Treehouse
local ModelWorldPivot = Model:GetPivot()
local NewPivot = ModelWorldPivot * CFrame.fromOrientation(0, 90, 0)
Model:PivotTo(NewPivot)
Yes you’re right, their just not what I needed. I’m trying to do like an obby with a wrecking ball moving back and fourth, there could also be a way we can try to weld it, but I already tried that also didnt work. Thank you for looking though, reply if you could find a way.
Thanks for the people trying to help, but I have figured it out, I did learn you cannot tween this, so here is what worked for me. Best of Luck!
local maxSwingAngle = math.rad(15)
local currentAngle = 0
local swingSpeed = math.rad(1)
while true do
currentAngle = currentAngle + swingSpeed
if currentAngle >= maxSwingAngle or currentAngle <= -maxSwingAngle then
swingSpeed = -swingSpeed
end
local rotation = CFrame.fromOrientation(0, 0, currentAngle)
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * rotation)
wait()
end