local Doors = game:GetService('Workspace').Doors local Players = game:GetService('Players') local RankSettings = require(script.RankSettings) local DoorEvent = game:GetService('ReplicatedStorage'):FindFirstChild('DoorEvent') or Instance.new('RemoteEvent',game:GetService('ReplicatedStorage')) DoorEvent.Name = 'DoorEvent' local accessLevels = { ["OMNI"] = 6, ["L5"] = 5, ["L4"] = 4, ["L3"] = 3, ["L2"] = 2, ["L1"] = 1, ["L0"] = 0, ["CLASS-D"] = -1 } function getHighestLevel(plr) local AccessLevel = plr:FindFirstChild("AccessLevel") local highestFound = 0 for _,x in pairs (AccessLevel:GetChildren()) do if accessLevels[x] then if accessLevels[x] > highestFound then highestFound = accessLevels[x] end end end return highestFound end function lockdownCheck(plr) local lockdown = game:GetService("ServerStorage"):WaitForChild("siteLockdown") if lockdown.Value == false then return true -- will show the script that lockdown is off/bypassed and will pass the lockdown and check their keycard else if lockdown.lockdownLevel.Value == 1 then if plr:GetRankInGroup(11233706) <= 2 then -- if the user is CE or below return false -- will show the script that the user cant open the door else return true end elseif lockdown.lockdownLevel.Value == 2 then if getHighestLevel(plr) <= 1 then return false else return true end elseif lockdown.lockdownLevel.Value == 3 then if getHighestLevel(plr) <= 3 then return false else return true end elseif lockdown.lockdownLevel.Value == 4 then if getHighestLevel(plr) <= 4 then return false else return true end elseif lockdown.lockdownLevel.Value == 5 then if getHighestLevel(plr) < 6 then return false else return true end elseif lockdown.lockdownLevel.Value == 6 then if plr:GetRankInGroup(11233706) < 254 and not table.find(userBypass,plr.UserId) then return false else return true end end end end local Debug = false DoorEvent.OnServerEvent:connect(function(player,Type,arg1,arg2) if player:FindFirstChild('AccessLevel') then local AccessLevel = player.AccessLevel if Type == 'OpenDoor' then local DoorSettings = require(arg1.Settings) local Allowed = false for i,v in pairs(DoorSettings['Allowed']) do for _,x in pairs (AccessLevel:GetChildren()) do if v == x.Name then Allowed = true end end end if not lockdownCheck(player) then Allowed = false end if Allowed then if arg1:FindFirstChild('CoolDown') then if Debug then print('[DEBUG] '..player.Name..' tried to open door but door is on cooldown') end else if player:FindFirstChild("DoorsOpened").Value <= 8 then player:FindFirstChild("DoorsOpened").Value = player:FindFirstChild("DoorsOpened").Value + 1 DoorEvent:FireAllClients(arg1) local new = Instance.new('BoolValue',arg1) new.Name = 'CoolDown' local cooldowntime if arg1.Name == "PushDoor" then local clone = script.PushOpen:Clone() clone.Parent = arg1.DoorFrame.Part clone:Play() for i,v in pairs (arg1.Door:GetDescendants()) do if v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("Part") and (v.Name ~= "BeginPos" and v.Name ~= "EndPos" and v.Name ~= "MovingPart" and v.Name ~= "BasePart" and v.Name ~= "HandlePart1" and v.Name ~= "HandlePart2" and v.Name ~= "LeftEndPos" and v.Name ~= "LeftBeginPos" and v.Name ~= "RightBeginPos" and v.Name ~= "RightEndPos") then wait(0.15) v.CanCollide = false v.Transparency = 1 end end wait(3.5) clone:Destroy() local new = script.PushClose:Clone() new.Parent = arg1.DoorFrame.Part new:Play() for i,v in pairs (arg1.Door:GetDescendants()) do if v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("Part") and (v.Name ~= "BeginPos" and v.Name ~= "EndPos" and v.Name ~= "MovingPart" and v.Name ~= "BasePart" and v.Name ~= "HandlePart1" and v.Name ~= "HandlePart2" and v.Name ~= "LeftEndPos" and v.Name ~= "LeftBeginPos" and v.Name ~= "RightBeginPos" and v.Name ~= "RightEndPos") then wait(0.15) v.CanCollide = true v.Transparency = 0 end end wait(1) new:Destroy() cooldowntime = 0 elseif arg1.Name == "SlidingDoor" then local clone = script.SlideOpen:Clone() clone.Parent = arg1.DoorFrame clone:Play() for i,v in pairs (arg1.Door:GetDescendants()) do if v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("Part") and (v.Name ~= "BeginPos" and v.Name ~= "EndPos" and v.Name ~= "MovingPart" and v.Name ~= "BasePart" and v.Name ~= "HandlePart1" and v.Name ~= "HandlePart2" and v.Name ~= "LeftEndPos" and v.Name ~= "LeftBeginPos" and v.Name ~= "RightBeginPos" and v.Name ~= "RightEndPos") then wait(0.15) v.CanCollide = false v.Transparency = 1 end end wait(3.2) clone:Destroy() local new = script.SlideClose:Clone() new.Parent = arg1.DoorFrame new:Play() for i,v in pairs (arg1.Door:GetDescendants()) do if v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("Part") and (v.Name ~= "BeginPos" and v.Name ~= "EndPos" and v.Name ~= "MovingPart" and v.Name ~= "BasePart" and v.Name ~= "HandlePart1" and v.Name ~= "HandlePart2" and v.Name ~= "LeftEndPos" and v.Name ~= "LeftBeginPos" and v.Name ~= "RightBeginPos" and v.Name ~= "RightEndPos") then wait(0.15) v.CanCollide = true v.Transparency = 0 end end wait(2.3) new:Destroy() cooldowntime = 0 elseif arg1.Name == "LargeDoor" then if arg1:FindFirstChild("DoubleSide") then local clone = script.SlideOpen:Clone() clone.Parent = arg1.DoorFrame.FrameMain clone:Play() for i,v in pairs (arg1.Door:GetDescendants()) do if v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("Part") and (v.Name ~= "BeginPos" and v.Name ~= "EndPos" and v.Name ~= "MovingPart" and v.Name ~= "BasePart" and v.Name ~= "HandlePart1" and v.Name ~= "HandlePart2" and v.Name ~= "LeftEndPos" and v.Name ~= "LeftBeginPos" and v.Name ~= "RightBeginPos" and v.Name ~= "RightEndPos") then wait(0.15) v.CanCollide = false v.Transparency = 1 end end wait(4) clone:Destroy() local new = script.SlideClose:Clone() new.Parent = arg1.DoorFrame.FrameMain new:Play() for i,v in pairs (arg1.Door:GetDescendants()) do if v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("Part") and (v.Name ~= "BeginPos" and v.Name ~= "EndPos" and v.Name ~= "MovingPart" and v.Name ~= "BasePart" and v.Name ~= "HandlePart1" and v.Name ~= "HandlePart2" and v.Name ~= "LeftEndPos" and v.Name ~= "LeftBeginPos" and v.Name ~= "RightBeginPos" and v.Name ~= "RightEndPos") then wait(0.15) v.CanCollide = true v.Transparency = 0 end end wait(4) new:Destroy() cooldowntime = 1 else local clone = script.DoubleOpen:Clone() clone.Parent = arg1.DoorFrame.FrameMain clone:Play() for i,v in pairs (arg1.Door:GetDescendants()) do if v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("Part") and (v.Name ~= "BeginPos" and v.Name ~= "EndPos" and v.Name ~= "MovingPart" and v.Name ~= "BasePart" and v.Name ~= "HandlePart1" and v.Name ~= "HandlePart2" and v.Name ~= "LeftEndPos" and v.Name ~= "LeftBeginPos" and v.Name ~= "RightBeginPos" and v.Name ~= "RightEndPos") then wait(0.15) v.CanCollide = false v.Transparency = 1 end end wait(13) clone:Destroy() local new = script.DoubleClose:Clone() new.Parent = arg1.DoorFrame.FrameMain new:Play() for i,v in pairs (arg1.Door:GetDescendants()) do if v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("Part") and (v.Name ~= "BeginPos" and v.Name ~= "EndPos" and v.Name ~= "MovingPart" and v.Name ~= "BasePart" and v.Name ~= "HandlePart1" and v.Name ~= "HandlePart2" and v.Name ~= "LeftEndPos" and v.Name ~= "LeftBeginPos" and v.Name ~= "RightBeginPos" and v.Name ~= "RightEndPos") then wait(0.15) v.CanCollide = true v.Transparency = 0 end end wait(4) new:Destroy() cooldowntime = 1 end end wait(cooldowntime) new:Destroy() player:FindFirstChild("DoorsOpened").Value = player:FindFirstChild("DoorsOpened").Value - 1 end end else if Debug then print('[DEBUG] '..player.Name..' tried to open door but did not have access to it.') end end end else game.ReplicatedStorage:WaitForChild("ExploitHook"):Fire(player, "Attempted to use doors without access level.") return end end) Players.PlayerAdded:connect(function(player) local AccessLevel = Instance.new('Folder',player) AccessLevel.Name = 'AccessLevel' local DoorsOpened = Instance.new("NumberValue",player) DoorsOpened.Name = "DoorsOpened" local CurrentLevel = "CLASS-D" for i,v in pairs(RankSettings['Groups']) do local PlrRank = player:GetRankInGroup(tonumber(i)) if v[tostring(PlrRank)] ~= nil then local new = Instance.new("StringValue",AccessLevel) new.Name = v[tostring(PlrRank)] end end player:GetPropertyChangedSignal("Team"):Connect(function() for i,v in pairs (RankSettings['Teams']) do if player.Team.Name == i then for i,v in pairs (AccessLevel:GetChildren()) do if v.Value == "Department" then v:Destroy() end end local new = Instance.new("StringValue",AccessLevel) new.Name = v new.Value = 'Department' elseif player.Team.Name == "Foundation Personnel" then for i,v in pairs (AccessLevel:GetChildren()) do if v.Value == "Department" then v:Destroy() end end end end end) DoorsOpened:GetPropertyChangedSignal("Value"):Connect(function() if DoorsOpened.Value > 8 then player:Kick("Unusual client behavior.") game.ReplicatedStorage:WaitForChild("ExploitHook"):Fire(player,"Attempting to fire an event which would open all doors.") end end) end) -- Weld doors function Weld(model) local Base = model.MovingPart for i,v in pairs (model:GetChildren()) do if v~=Base then if v:IsA('BasePart') or v:IsA('UnionOperation') or v:IsA('MeshPart') then local Weld = Instance.new("WeldConstraint") Weld.Parent = Base Weld.Part0 = Base Weld.Part1 = v v.Anchored = false end end end end for i,v in pairs(Doors:GetChildren()) do if v:IsA('Model') then if v.Name == "LargeDoor" then Weld(v.Door.Left) Weld(v.Door.Right) else Weld(v.Door) end end end