This script was made in 2016 or 2017 and it worked perfectly back then but now it’s not working, I’m guessing it’s very outdated but I am hoping someone can help me fix it or lead me in the right direction as I am not a scripter nor am I able to afford one.
The script inside the cell door named “CellController” is:
ref=script.Parent.ref
ref.Changed:connect(function()
if ref.Value==nil then return end
if ref.Value.Parent==nil then ref.Value=nil return end
script.Parent.door.sign.SurfaceGui.TextLabel.Text=ref.Value.Name
end)
local door_debounce=false
function setDoorState(state)
if door_debounce then repeat wait(math.random(1,10)/10) until not door_debounce end door_debounce=true
if script.Parent.doorstate.Value==state then return end
script.Parent.doorstate.Value=state
if state==true then --Open
for i=1, 10 do wait()
for _,p in pairs(script.Parent.door:children()) do
p.CFrame=p.CFrame*CFrame.new(0,0,-.02)
end
end wait(0.5)
for i=1, 40 do wait()
for _,p in pairs(script.Parent.door:children()) do
p.CFrame=p.CFrame*CFrame.new(-.1,0,0)
end
end
else --Close
for i=1, 40 do wait()
for _,p in pairs(script.Parent.door:children()) do
p.CFrame=p.CFrame*CFrame.new(.1,0,0)
end
end wait(0.5)
for i=1, 10 do wait()
for _,p in pairs(script.Parent.door:children()) do
p.CFrame=p.CFrame*CFrame.new(0,0,.02)
end
end
end
door_debounce=false
end
script.Parent.action_door.Changed:connect(function()
setDoorState(script.Parent.action_door.Value)
end)
The script inside of the Door Controller itself is:
script.Parent.Selected:connect(function(mouse)
mouse.Button1Down:connect(function()
local t=mouse.Target
if t==nil then return end
if t.Parent==nil then return end
if t.Parent.Parent:FindFirstChild("action_door") then
if game.Players.LocalPlayer:DistanceFromCharacter(t.Position)<10 then
t.Parent.Parent.action_door.Value=not t.Parent.Parent.doorstate.Value
end
end
end)
end)