I have 2 sliding doors, and they open if a player gets into an area, and close if a player gets out of the area. The doors open fine and the second door closes as well, but the first one doesn’t close no matter what, and there is no error too.
local TeleportPad = game.Workspace.LeaderBoardHouse.Teleporter.TeleportPad
local OpenDetector = game.Workspace.LeaderBoardHouse.Teleporter.OpenDetector
local InPart = game.Workspace.LeaderBoardHouse.Teleporter.InTeleporterPart
local Door1 = game.Workspace.LeaderBoardHouse.Teleporter.GlassDoor1
local GDClosed = game.Workspace.LeaderBoardHouse.Teleporter.GDClosed
local Door2 = game.Workspace.LeaderBoardHouse.Teleporter.GlassDoor2
local TweenService = game:GetService("TweenService")
local GDClosed = game.Workspace.LeaderBoardHouse.Teleporter.GDClosed
local tweeningInformation = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local door1goal = {}
door1goal.Orientation = GDClosed.Orientation
door1goal.Position = GDClosed.Position
local tween1Open = TweenService:Create(Door1,tweeningInformation,door1goal)
local door1Open = {CFrame = CFrame.new(-23.196, -3.347, 148.415)}
local door1Close = {CFrame = CFrame.new(-23.196, -3.347, 142.957)}
local door2Open = {CFrame = CFrame.new(-32.5, -3.322, 139.709)}
local door2Close = {CFrame = CFrame.new(-26.556, -3.322, 139.709)}
local tween1close = TweenService:Create(GDClosed,tweeningInformation,door1Close)
local tween2open = TweenService:Create(Door2,tweeningInformation,door2Open)
local tween2close = TweenService:Create(Door2,tweeningInformation,door2Close)
OpenDetector.Touched:Connect(function(hit)
local char = hit.Parent
local humanoid = char:FindFirstChildWhichIsA("Humanoid")
if humanoid then
tween1Open:Play()
tween2open:Play()
end
end)
OpenDetector.TouchEnded:Connect(function(hit)
local char = hit.Parent
local humanoid = char:FindFirstChildWhichIsA("Humanoid")
if humanoid then
tween1close:Play()
tween2close:Play()
end
end)
TeleportPad.Touched:Connect(function(hit)
local char = hit.Parent
local humanoid = char:FindFirstChildWhichIsA("Humanoid")
if humanoid then
tween2close:Play()
tween1close:Play()
end
end)
TeleportPad.Touched:Connect(function(hit)
local char = hit.Parent
local humanoid = char:FindFirstChildWhichIsA("Humanoid")
local Root = char:WaitForChild("HumanoidRootPart")
if humanoid then
game.Workspace.LeaderBoardHouse.Teleporter.TeleportPad.LaserCharge:Play()
wait(6.671)
game.Workspace.LeaderBoardHouse.Teleporter.TeleportPad.LaserSound:Play()
Root.Positon = game.Workspace.HouseRoofTeleport.Position
end
end)
Most of the script is unorganised, and the last bit doesn’t work because i’m new to scripting, but i put all of the script just if it may help.