I’ve been trying to make 2 doors slide for the past 3 hours and eventually had to implement PrimaryPart good old stuff into them. I did what I do best, hope that things work and fix any errors, but I’m not too sure on this error. If anyone could help, much appreciated. Code below.
local tween = game:GetService("TweenService")
local doorModel = workspace.DoubleDoors.One
doorModel.Left.PrimaryPart = doorModel.Left.Primary
doorModel.Right.PrimaryPart = doorModel.Right.Primary
local left = doorModel.Left
local right = doorModel.Right
local tiInfo = TweenInfo.new(0.5)
local leftGoalOpen = {}
local leftGoalClose = {}
local rightGoalOpen = {}
local rightGoalClose = {}
leftGoalOpen:PivotTo(left.PrimaryPart, left.PrimaryPart.CFrame * CFrame.new(left.PrimaryPart.Size.X, 0, 0))
leftGoalClose:PivotTo(left.PrimaryPart, left.PrimaryPart.CFrame)
local leftOpen = tween:Create(left, tiInfo, leftGoalOpen)
local leftClose = tween:Create(left, tiInfo, leftGoalClose)
rightGoalOpen:PivotTo(right.PrimaryPart, right.PrimaryPart.CFrame * CFrame.new(-right.PrimaryPart.Size.X, 0, 0))
rightGoalClose:PivotTo(right.PrimaryPart, right.PrimaryPart.CFrame)
local rightOpen = tween:Create(right, tiInfo, rightGoalOpen)
local rightClose = tween:Create(right, tiInfo, rightGoalClose)
script.Parent.Lock:GetPropertyChangedSignal("Value"):Connect(function()
if script.Parent.Lock.Value == true then
doorModel.Proximity.Open.Enabled = false
if doorModel.Proximity.Open.ActuallyOpen.Value == true then
doorModel.Proximity.Open.ActuallyOpen.Value = false
rightGoalClose:Play()
leftGoalClose:Play()
doorModel.Left.LeftNeon.Color = Color3.fromRGB(255, 0, 0)
doorModel.Right.RightNeon.Color = Color3.fromRGB(255, 0, 0)
end
else
doorModel.Proximity.Open.Enabled = true
doorModel.Left.LeftNeon.Color = Color3.fromRGB(255, 255, 255)
doorModel.Right.RightNeon.Color = Color3.fromRGB(255, 255, 255)
end
end)
game:GetService("ServerStorage").Controls.Power:GetPropertyChangedSignal("Value"):Connect(function()
if game:GetService("ServerStorage").Controls.Power.Value == true then
local surfacegui = script.Parent.SurfaceGui
local status = surfacegui.STATUS
local text = surfacegui.TEXT
if status.TextColor3 == Color3.fromRGB(126, 255, 244) then return warn("Cannot start while already started") end
status.TextColor3 = Color3.fromRGB(126, 255, 244)
text.TextColor3 = Color3.fromRGB(126, 255, 244)
text.Text = "Welcome"
script.Parent.switch_on:Play()
wait(3)
text.Text = "Loading:\ndoor connection"
wait(1)
text.Text = "Loading:\noverheating warning"
wait(1)
text.Text = "Loading:\nfire alarm"
wait(math.random(3,5))
text.Text = "Loading:\nidle"
wait(1)
text.Text = "Loading:\nin movement"
wait(1)
text.Text = "Loading:\nlockdown warning"
wait(1)
text.Text = "Loading:\ndoor magnematic lock"
wait(math.random(5,15))
text.Text = "Reinforcing lock - please wait"
wait(5)
text.Text = "Loading:\ncore systems"
wait(5)
local broken = math.random(1,5)
if broken <= 2 then
text.Text = "An increased heat source has been detected in core:/lockmain/fire/value"
wait(math.random(1,10))
status.TextColor3 = Color3.fromRGB(255, 85, 0)
text.TextColor3 = Color3.fromRGB(255, 85, 0)
text.Text = "WARNING"
wait(2)
text.Text = "OVERHEATING"
wait(2)
text.Text = "WARNING"
wait(2)
text.Text = "OVERHEATING"
script.Parent.Parent.fire.Fire.Enabled = true
script.Parent.Parent.Part.fix.Enabled = true
script.Parent.fire_alarm.Looped = true
script.Parent.fire_alarm:Play()
else
text.Text = "Idle"
status.TextColor3 = Color3.fromRGB(255, 255, 255)
text.TextColor3 = Color3.fromRGB(255, 255, 255)
script.Parent.Lock.Value = false
end
local breakingbad = math.random(1,10)
if breakingbad == 6 then
text.Text = "BLAST WARNING\nSEEK SHELTER"
script.Parent.Parent.fire.Fire.Enabled = true
script.Parent.fire_alarm:Play()
status.TextColor3 = Color3.fromRGB(255, 0, 0)
text.TextColor3 = Color3.fromRGB(255, 0, 0)
wait(math.random(5,20))
local expl = Instance.new("Explosion")
expl.ExplosionType = Enum.ExplosionType.NoCraters
expl.BlastRadius = 50
expl.Parent = script.Parent
game.ServerStorage.Controls.Power.Value = false
wait(2)
game.ServerStorage.Controls.Power.Value = true
end
while wait(300) do
broken = math.random(1,5)
if broken <= 2 then
print("Monitor broke")
wait(math.random(1,10))
script.Parent.Lock.Value = true
status.TextColor3 = Color3.fromRGB(255, 85, 0)
text.TextColor3 = Color3.fromRGB(255, 85, 0)
text.Text = "WARNING"
wait(2)
text.Text = "OVERHEATING"
wait(2)
text.Text = "WARNING"
wait(2)
text.Text = "OVERHEATING"
script.Parent.Parent.fire.Fire.Enabled = true
script.Parent.Parent.Part.fix.Enabled = true
script.Parent.fire_alarm.Looped = true
script.Parent.fire_alarm:Play()
else
print("Monitor intact")
-- nothing
end
end
doorModel.Proximity.Open.Triggered:Connect(function()
if doorModel.Proximity.Open.ActuallyOpen.Value == false then
leftOpen:Play()
rightOpen:Play()
else
rightClose:Play()
leftClose:Play()
end
end)
elseif game:GetService("ServerStorage").Controls.Power.Value == false then
local surfacegui = script.Parent.SurfaceGui
local status = surfacegui.STATUS
local text = surfacegui.TEXT
status.TextColor3 = Color3.fromRGB(0, 0, 0)
text.TextColor3 = Color3.fromRGB(0, 0, 0)
text.Text = "Powered off"
script.Parent.switch_off:Play()
end
end)