Sliding Door Is Not Working

Hello, developers! My sliding door is not working.

Code:

script.Parent.ObjectText = "Level "..script.Parent.Parent.Requirement.Value.." Door"

local TweenService = game:GetService("TweenService")
local TweenInfoO = TweenInfo.new(3)
local OpenD = script.Parent.Parent.DoorOpen
local CloseD = script.Parent.Parent.DoorClose
local Open = false

local Door1 = script.Parent.Parent.Parent:FindFirstChild("Door1")
local Door2 = script.Parent.Parent.Parent:FindFirstChild("Door2")

local DoorTween = {}
DoorTween.Position = Vector3.new(DoorTween.Position.X, DoorTween.Position.Y + 0.002, DoorTween.Position.Z + 3.778)

local DoorTween2 = {}
DoorTween2.Position = Vector3.new(DoorTween2.Position.X, DoorTween2.Position.Y - 0.002, DoorTween2.Position.Z - 3.778)

local Door2Tween = {}
Door2Tween.Position = Vector3.new(Door2Tween.Position.X, Door2Tween.Position.Y - 0.002, Door2Tween.Position.Y - 3.796)

local Door2Tween2 = {}
Door2Tween2.Position = Vector3.new(Door2Tween2.Position.X, Door2Tween2.Position.Y + 0.002, Door2Tween2.Position.Y + 3.796)

function Toggled(Player)
	if Open == false then
		Open = true
		OpenD:Play()
		TweenService:Create(Door1, TweenInfoO, DoorTween):Play()
		TweenService:Create(Door2, TweenInfoO, Door2Tween):Play()
		task.wait(3)
		CloseD:Play()
		TweenService:Create(Door1, TweenInfoO, DoorTween2):Play()
		TweenService:Create(Door2, TweenInfoO, Door2Tween2):Play()
		Open = false
	end
end

script.Parent.Triggered:Connect(Toggled)

Error:
image
How would I get the values of the position? Also, when I first tested this out the door tweened sideways too.

(Sorry for not much information, but i’ve been stuck on this for 5 hours now. :woozy_face: )

What are you trying to here?
image

Try this

-- This is only for Door1
local DoorTween = {Position = Vector3.new(Door1.Position.X, Door1.Position.Y + 0.002, Door1.Position.Z + 3.778)}

Same error is happening but on line 17.

Make sure Door1 is a thing.

local Door1 = script.Parent.Parent.Parent:WaitForChild("Door1")

Yes, I have just check it and Door1 is an existing door.

And what is line 17? I cannot tell by the script shown above.

Is the door a model by any chance?

The door is a base part and is not a model.

And you’ve adapted all tweens to the method I have shown?

It is the door2 tweening lines. For some reason, the tween isn’t even trying to happen. I am going to fix the debounce and will get back to you.

So I got it to work now, but only door1 tweens and it tweens from left, all the way to the right and ends instead of going left to middle.

Never mind, I got it working with a few edits. Thank you!