Tween CFrame orientation

I’m attempting to tween a model’s primary part with CFrame. I’m using CFrame because the primary part has parts welded to it. I’ve tried looking for the solution in the Dev Forum, but not one worked. Here’s what I’ve got.

--General
local Body = script.Parent.PrimaryPart
local Tween = game:GetService("TweenService")

--Locations and Orientations
local Forward = Tween:Create(Body, TweenInfo.new(7), {CFrame = CFrame.new(-588.802, 126.855, 963.75)})

---What I need help with
local ForwardOrientation = Tween:Create(Body, TweenInfo.new(7), {CFrame = CFrame.Angles(0,math.rad(90),0)})
--What I need help with

local Back = Tween:Create(Body, TweenInfo.new(7), {CFrame = CFrame.new(-295.79, 127.319, 963.217)})

--Loop
wait(5)
while true do
	Forward:Play()
	ForwardOrientation:Play()
wait(15)
	Back:Play()
	wait(15)
	end
1 Like

You have to take the part’s initial CFrame and then multiply it by your desired offset.

local ForwardOrientation = Tween:Create(Body, TweenInfo.new(7), {CFrame = Body.CFrame * CFrame.Angles(0,math.rad(90),0)})
1 Like

That got it working! That’s for the help!

1 Like

While testing it, I found out after doing the first tween, the orientation would instantly undo the first tween and go back to the original location.

Still gonna need some help; I’m still very lost in what to do.

You would have to create a new tween each time.

while true do
	Forward:Play()
    local ForwardOrientation = Tween:Create(Body, TweenInfo.new(7), {CFrame = CFrame.Angles(0,math.rad(90),0)})
    ForwardOrientation:Play()
1 Like

Sorry for the WAYYY late response. I’m gonna test this and edit once I have an answer.

EDIT: Works great! Thank you again for the help!

1 Like