I’m trying to tween the position of a part from point 1 to point 2 then back to point 1 and so forth.
The problem is that when I try to Tween the CFrame, the Orientation also gets Tweened to 0,0,0 which I do not want.
This is probably a very easy fix but I can’t figure it out
local part = script.Parent
local ts = game:GetService("TweenService")
while true do
local tweeninfo1 = TweenInfo.new(
4,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false,
0
)
local tween0 = ts:Create(
part,
tweeninfo1,
{CFrame = CFrame.new(-405.469, 29.518, -200.444)}
)
tween0:Play()
part.Orientation = Vector3.new(0,-90,0) --This is the value it needs to stay but this doesn't help, only stays like this for a short period
tween0.Completed:Wait()
local tween1 = ts:Create(
part,
tweeninfo1,
{CFrame = CFrame.new(-362.469, 29.518, -200.444)}
)
tween1:Play()
tween1.Completed:Wait()
end
Kinda funny really. Anyway the reason it changes orientation is probably because you didn’t supply a custom orientation to CFrame.new(), so it will take orientation as 0,0,0
Yea I was also stunned by this since I’ve always used CFrame to change the position something is in, however I’ve never used Tween service for changing someones position until now it. Still new to scripting so mistakes are to be made haha.