How do I keep two parts in the same direction/orientation when tweening them

So, I already tried:

CFrame.fromEulerAnglesXYZ(0, 90, 0)

It didn’t work out well…

All I want to do is keep two of my door at (0, 90, 0) while tweening, but when they tween, it goes to (0, 0, 0)

If anyone can help, please tell me

Here’s My Code:

-- Created by GalacticQuasar, June 21, 2020 ("Door Opening and Closing Animation")

-- Variables
local TweenService = game:GetService("TweenService")
local door1 = script.Parent:WaitForChild("Door3")
local door2 = script.Parent:WaitForChild("Door4")

-- Main:
local tweeningInformation = TweenInfo.new(
	0.5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

-- All Door Positions & Tweens

-- Door Opening Position
local door1Open = {CFrame = CFrame.new(-157.364, 9.155, 143.169)} 
local door2Open = {CFrame = CFrame.new(-157.364, 9.155, 177.146)} 

-- Door Closing Positions
local door1Close = {CFrame = CFrame.new(-157.364, 9.155, 155.019)}
local door2Close = {CFrame = CFrame.new(-157.364, 9.155, 163.866)} 

-- Tweening Service
local tween1open = TweenService:Create(door1,tweeningInformation,door1Open)
local tween1close = TweenService:Create(door1,tweeningInformation,door1Close)
local tween2open = TweenService:Create(door2,tweeningInformation,door2Open)
local tween2close = TweenService:Create(door2,tweeningInformation,door2Close)

local Panel = game.Workspace.Panel

-- Detector Scripts:
local CanPlay = true

script.Parent.Detector1.Touched:Connect(function(hit)
	if CanPlay then
	CanPlay = false
	Sound1 = game.Workspace.Sound1
	Sound1:Play()
	Panel.Transparency = 1
	tween1open:Play()
	tween2open:Play()
	wait(2)
	tween1close:Play()
		tween2close:Play()
	wait(0.1)	
		CanPlay = true
				Panel.Transparency = 0
		end
end)

local Panel = game.Workspace.Panel

script.Parent.Detector2.Touched:Connect(function(hit)
		if CanPlay then
	CanPlay = false
	Sound1 = game.Workspace.Sound1
	Sound1:Play()
	Panel.Transparency = 1
	tween1open:Play()
	tween2open:Play()
	wait(2)
	tween1close:Play()
		tween2close:Play()
	wait(0.1)	
		CanPlay = true
			Panel.Transparency = 0
		end
end)

try doing Position = Vector3.new() instead of cframe

1 Like

Alright, I’ll try it out. Thanks.

It worked, thanks a lot, mate!