Sliding Doors Issues

Hello there!
I recently watched Alvin Blox’s sliding door tutorial, which I now know is outdated, since it was made in 2018, but how can I fix the doors? I tried them in Studio, and they worked fine in one place, but when I tried them in another place in Studio, they didn’t work. What do I do?
Doors working:

Doors not working:

Script:

local TweenService = game:GetService("TweenService")
local door1 = script.Parent.Door1
local door2 = script.Parent.Door2
local tweenInformation = TweenInfo.new(
	0.5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

local door1Open = {CFrame = CFrame.new(-17.124, 357.266, -722.062)}
local door2Open = {CFrame = CFrame.new(-17.184, 357.266, -742.666)}
local door1Close = {CFrame = CFrame.new(-17.124, 357.266, -727.922)}
local door2Close = {CFrame = CFrame.new(-17.184, 357.266, -736.556)}
local tween1Open = TweenService:Create(door1, tweenInformation, door1Open)
local tween1Close = TweenService:Create(door1, tweenInformation, door1Close)
local tween2Open = TweenService:Create(door2, tweenInformation, door2Open)
local tween2Close = TweenService:Create(door2, tweenInformation, door2Close)

script.Parent.Detector1.Touched:Connect(function(hit)
	tween1Open:Play()
	tween2Open:Play()
	wait(2)
	tween1Close:Play()
	tween2Close:Play()
end)

script.Parent.Detector2.Touched:Connect(function(hit)
	tween1Open:Play()
	tween2Open:Play()
	wait(2)
	tween1Close:Play()
	tween2Close:Play()
end)
3 Likes

Are they not opening?
What do you mean by they aren’t working?

Edit: sorry i didn’t see the video disregard this

1 Like

There is a simpler way to make sliding doors. You do not have to put the closing CFrame just have the tween reverse. Where it says false just change it to true on the tween info.

So this is just a hunch but I’m pretty sure this is happening because your not setting the rotation of the CFrame so its setting it to 0,0,0 and thus rotating as this probably wasn’t a problem in the first place because the doors were facing the default rotation try changing the door variables to this.
I’m not that good with TweenService so this might not work

local door1Open = {CFrame.Position = Vector3.new(-17.124, 357.266, -722.062)}
local door2Open = {CFrame.Position = Vector3.new(-17.184, 357.266, -742.666)}
local door1Close = {CFrame.Position = Vector3.new(-17.124, 357.266, -727.922)}
local door2Close = {CFrame.Position = Vector3.new(-17.184, 357.266, -736.556)}
1 Like

Firstly, are there any errors?

No errors. Here’s a thought I just came up with. What if I replaced the doors there with new doors? That way, they would be oriented to the default rotation, and I could just rresize them? I’ll have to check that in the morning.

Try replacing the first 4 lines with this

local door1Open = {CFrame = script.Parent.Door1.CFrame - Vector3.new(0,0,5)}
local door2Open = {CFrame = script.Parent.Door1.CFrame + Vector3.new(0,0,6)}
local door1Close = {CFrame = script.Parent.Door1.CFrame + Vector3.new(0,0,5)}
local door2Close = {CFrame = script.Parent.Door1.CFrame - Vector3.new(0,0,6)}

It keeps the same CFrame using the doors CFrame, then adds position to the CFrame, which tweens it to that position without bending like in the video.

2 Likes