Anyone know a fix for this sliding door error

  1. Ok for some reason only the doors facing a certain direction work, the others do this

robloxapp-20200410-2203465.wmv (3.2 MB)

What can I do to fix this?

local TweenService = game:GetService("TweenService")
local door1 = script.Parent:WaitForChild("Average Security Door1")
local door2 = script.Parent:WaitForChild("Average Security Door2")
local tweeningInformation = TweenInfo.new(
	0.5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)
local door1Open = {CFrame = CFrame.new(166, -1.5, -1214.07)}
local door2Open = {CFrame = CFrame.new(153.75, -1.5, -1213.57)}
local door1Close = {CFrame = CFrame.new(159.875, -1.5, -1214.07)}
local door2Close = {CFrame = CFrame.new(159.875, -1.5, -1213.57)}
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 player = game.Players.LocalPlayer



script.Parent.Detector1.Touched:Connect(function(hit)
	
	
	local Doorkey = hit:findFirstChild("Keycard")
	if Doorkey then
		tween1Open:Play()
		tween2Open:Play()
		script.Parent.Sign1.BrickColor = BrickColor.Green()
		script.Parent.Sign2.BrickColor = BrickColor.Green()
		script.Parent.Sign3.BrickColor = BrickColor.Green()
		script.Parent.Sign4.BrickColor = BrickColor.Green()
		script.Parent.Sign5.BrickColor = BrickColor.Green()
		script.Parent.Sign6.BrickColor = BrickColor.Green()
		wait(2)
		tween1Close:Play()
		tween2Close:Play()
		script.Parent.Sign1.BrickColor = BrickColor.White()
		script.Parent.Sign2.BrickColor = BrickColor.White()
		script.Parent.Sign3.BrickColor = BrickColor.White()
		script.Parent.Sign4.BrickColor = BrickColor.White()
		script.Parent.Sign5.BrickColor = BrickColor.White()
		script.Parent.Sign6.BrickColor = BrickColor.White()
	else
		
	end
end)
script.Parent.Detector2.Touched:Connect(function(hit)
	
	
	local Doorkey = hit:findFirstChild("Keycard")
	if Doorkey then
		tween1Open:Play()
		tween2Open:Play()
		script.Parent.Sign1.BrickColor = BrickColor.Green()
		script.Parent.Sign2.BrickColor = BrickColor.Green()
		script.Parent.Sign3.BrickColor = BrickColor.Green()
		script.Parent.Sign4.BrickColor = BrickColor.Green()
		script.Parent.Sign5.BrickColor = BrickColor.Green()
		script.Parent.Sign6.BrickColor = BrickColor.Green()
		wait(2)
		tween1Close:Play()
		tween2Close:Play()
		script.Parent.Sign1.BrickColor = BrickColor.White()
		script.Parent.Sign2.BrickColor = BrickColor.White()
		script.Parent.Sign3.BrickColor = BrickColor.White()
		script.Parent.Sign4.BrickColor = BrickColor.White()
		script.Parent.Sign5.BrickColor = BrickColor.White()
		script.Parent.Sign6.BrickColor = BrickColor.White()
	else
		
		
	end
end)

door script

1 Like

If I were you I would clean the script more, but for the sake of fixing your problem this is how you would fix it:

You’re using CFrame meaning when the door is being tweened and the orientation is being set to 0 by default. try doing this instead:

local door1Open = {Position = Vector3.new(166, -1.5, -1214.07)}
local door2Open = {Position = Vector3.new(153.75, -1.5, -1213.57)}
local door1Close = {Position = Vector3.new(159.875, -1.5, -1214.07)}
local door2Close = {Position  = Vector3.new(159.875, -1.5, -1213.57)}
1 Like

Thanks, Im going to do that right away!

1 Like