Advertisement
LawMixer

sss

Jul 28th, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. local PlayersService = game:GetService("Players")
  2. local CollectionService = game:GetService("CollectionService")
  3. local DOORS = CollectionService:GetTagged("PrimaryDoor")
  4. local DoorModule = require(script.Parent.Parent.Libraries.DoorModule)
  5. local Permissions = require(script.Parent.Parent.Libraries.Permissions)
  6.  
  7.  
  8. game.ReplicatedStorage.RemoteEvent.DoorSystem.OnServerEvent:Connect(function(player, doorModel, scannerModel)
  9. if not doorModel or not scannerModel then return false end
  10. if DoorModule.hasCooldown(doorModel) then return false end
  11. if not CollectionService:HasTag(doorModel, "PrimaryDoor") then return false end
  12. if doorModel:FindFirstChild("Configuration") == nil then return false end
  13. if doorModel.Configuration.DoorType.Value ~= script.Name then return false end
  14. if script.Parent.Parent.Libraries.Permissions:FindFirstChild(doorModel.Configuration.Permissions.Value) == nil then return false end
  15. -- if not DoorModule.canSeeDoor(doorModel, player.Character) then return false end
  16.  
  17. local DoorConfiguration = DoorModule.returnDoorConfiguration(doorModel.Configuration.DoorType.Value)
  18. print(Permissions.returnPermission(plr, team))
  19.  
  20. if not Permissions.returnPermission(plr, team) == false then
  21. scannerModel.PrimaryPart.Keycard_Denied:Play()
  22. scannerModel.PrimaryPart.Color = Color3.fromRGB(255, 0, 0)
  23. delay(2, function()
  24. if doorModel.Configuration.Lockdown.Value then scannerModel.PrimaryPart.Color = Color3.fromRGB(218, 133, 65) else scannerModel.PrimaryPart.Color = Color3.fromRGB(13, 105, 172) end
  25. end)
  26. DoorModule.setCooldown(doorModel, DoorConfiguration["Cooldown"])
  27. return false
  28. else
  29. scannerModel.PrimaryPart.Keycard_Accepted:Play()
  30. scannerModel.PrimaryPart.Color = Color3.fromRGB(0, 255, 0)
  31. delay(2, function()
  32. if doorModel.Configuration.Lockdown.Value then scannerModel.PrimaryPart.Color = Color3.fromRGB(218, 133, 65) else scannerModel.PrimaryPart.Color = Color3.fromRGB(13, 105, 172) end
  33. end)
  34. end
  35.  
  36. doorModel.Configuration.Open.Value = not doorModel.Configuration.Open.Value
  37. DoorModule.setCooldown(doorModel, DoorConfiguration["Cooldown"])
  38. end)
  39.  
  40. ----------------------------------------------------------------------------------------------------
  41. for _, Door in pairs(DOORS) do
  42. if not CollectionService:HasTag(Door, "PrimaryDoor") then return false end
  43. if Door:FindFirstChild("Configuration") == nil then return false end
  44. if Door.Configuration.DoorType.Value ~= script.Name then return false end
  45. if script.Parent.Parent.Libraries.Permissions:FindFirstChild(Door.Configuration.Permissions.Value) == nil then return false end
  46.  
  47. local DoorConfiguration = DoorModule.returnDoorConfiguration(Door.Configuration.DoorType.Value)
  48.  
  49. Door.Configuration.Open:GetPropertyChangedSignal("Value"):Connect(function()
  50. if Door.Configuration.Open.Value then
  51. Door.Door0.PrismaticConstraint.Speed = DoorConfiguration["OpenSpeed"]
  52. Door.Door0.PrismaticConstraint.TargetPosition = DoorConfiguration["OpenTarget"]
  53. Door.Door1.PrismaticConstraint.Speed = DoorConfiguration["OpenSpeed"]
  54. Door.Door1.PrismaticConstraint.TargetPosition = DoorConfiguration["OpenTarget"]
  55.  
  56. Door.Door0.Door_Open:Play() Door.Door0.Door_Close:Stop()
  57. else
  58. Door.Door0.PrismaticConstraint.Speed = DoorConfiguration["CloseSpeed"]
  59. Door.Door0.PrismaticConstraint.TargetPosition = DoorConfiguration["CloseTarget"]
  60. Door.Door1.PrismaticConstraint.Speed = DoorConfiguration["CloseSpeed"]
  61. Door.Door1.PrismaticConstraint.TargetPosition = DoorConfiguration["CloseTarget"]
  62.  
  63. Door.Door0.Door_Open:Stop() Door.Door0.Door_Close:Play()
  64. end
  65. end)
  66.  
  67. Door.Configuration.Lockdown:GetPropertyChangedSignal("Value"):Connect(function()
  68. if Door.Configuration.Lockdown.Value then
  69. for _, Scanner in pairs(Door:GetChildren()) do
  70. if CollectionService:HasTag(Scanner, "InteractionSystem") then Scanner.PrimaryPart.Color = Color3.fromRGB(218, 133, 65) end
  71. end
  72. else
  73. for _, Scanner in pairs(Door:GetChildren()) do
  74. if CollectionService:HasTag(Scanner, "InteractionSystem") then Scanner.PrimaryPart.Color = Color3.fromRGB(13, 105, 172) end
  75. end
  76. end
  77. end)
  78. end
  79. ----------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement