How to stop tween rotation / change orientation with tweening

So, I want to create a sliding door by tweening. Everything working correctly except that it’s rotating. I’ve looked at other topics on rotation with tweeting but I’m having trouble understanding them. I basically need help with knowing how to rotate a tween so I can make the orientation specific or know how to stop it.
Here is my current script:

local TS = game:GetService("TweenService")
local D1 = game.Workspace.D1
local D1_Open = CFrame.new(game.Workspace.D1Goal.Position)
local cooldown = false
local TweeningInfoD1 = TweenInfo.new(
    1, 
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0, 
	false,
	0 
)

local PartPropertiesD1 = {
	CFrame = D1_Open;
	Orientation = Vector3.new(0,180,0)
}
script.Parent.Touched:Connect(function()
	if cooldown == false then
    cooldown = true
	local Tween = TS:Create(D1,TweeningInfoD1,PartPropertiesD1)
	Tween:Play()
		wait(5)
		cooldown = false
		end
end)

So, two things:

  1. CFrame has both a rotational and positional component. When you construct a CFrame using CFrame.new(POSITION), it will have zero orientation. Use D1Goal.CFrame and remove the CFrame.new call instead, but make sure D1Goal is properly aligned with your door’s final rotation and position.

  2. For PartPropertiesD1, you only need to specify the target CFrame since it also contains the rotational information of the goal.

1 Like