Advertisement
Guest User

PrisonerBoundaryHandlerZ1

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