Advertisement
Guest User

PrisonerBoundaryHandlerZ2

a guest
May 28th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. local ZonePlus = require(4664437268) -- Initiate Zone+
  2. local ZoneService = require(ZonePlus.ZoneService) -- Retrieve and require ZoneService
  3. local CELL_TIME = workspace.Boundaries.CellTime -- A container (i.e. Model or Folder) of parts that represent the zone
  4. local zone_2 = ZoneService:createZone("CellTimeBoundaries", CELL_TIME, 15) -- Construct a zone called 'ZoneName' using 'group' and with an extended height of 15
  5.  
  6. local function Between(input, num1, num2)
  7. if input >= num1 and input <= num2 then
  8. return true
  9. end
  10. end
  11.  
  12. -- Zone 2 (Cell Time)
  13. zone_2.playerAdded:Connect(function(player)
  14. local char = player.Character or player.CharacterAdded:Wait()
  15. local innocent = player.PrisonerStats.Innocent
  16.  
  17. if player.Team == game:GetService('Teams').Prisoners and innocent.Value then
  18. print(player.Name,"entered the zone 2! Make player innocent. -- CELL TIME")
  19.  
  20. if char.Head:FindFirstChild('Not Innocent') then
  21. char.Head['Not Innocent']:Destroy()
  22. end
  23.  
  24. innocent.Value = true
  25. end
  26. end)
  27. zone_2.playerRemoving:Connect(function(player)
  28. local char = player.Character or player.CharacterAdded:Wait()
  29. local innocent = player.PrisonerStats.Innocent
  30.  
  31. print(player.Name,"exited the zone 2! -- CELL TIME")
  32.  
  33. if player.Team == game:GetService('Teams').Prisoners and not char.Head:FindFirstChild('Not Innocent') then
  34. print(player.Name,"exited the zone 2! Make player guilty. -- CELL TIME")
  35.  
  36. local UI = game.ReplicatedStorage.TSIC["Not Innocent"]:Clone()
  37. UI.Parent = char.Head
  38.  
  39. innocent.Value = false
  40. end
  41. end)
  42.  
  43. -- Main
  44. local isLooping = false
  45. local removeZone = false
  46.  
  47. while (true) do
  48. wait(0.5)
  49.  
  50. local clockTime = game:GetService('Lighting').ClockTime
  51.  
  52. if Between(clockTime, 0, 7) and not isLooping then
  53. print('Init Zone2')
  54.  
  55. isLooping = true
  56. removeZone = false
  57.  
  58. spawn(function()
  59. zone_2:initLoop()
  60. end)
  61. elseif Between(clockTime, 0, 7) and isLooping then
  62. print('Zone2 --Cell time')
  63.  
  64. -- Do nothing
  65. elseif not Between(clockTime, 0, 7) and not removeZone then
  66. isLooping = false
  67. removeZone = true
  68.  
  69. zone_2:endLoop()
  70. elseif not Between(clockTime, 0, 7) and not isLooping then
  71. print('Zone2 --Free time')
  72.  
  73. -- Do nothing
  74. end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement