Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ZonePlus = require(4664437268) -- Initiate Zone+
- local ZoneService = require(ZonePlus.ZoneService) -- Retrieve and require ZoneService
- local NOT_CELL_TIME = workspace.Boundaries.NotCellTime -- A container (i.e. Model or Folder) of parts that represent the zone
- local zone_1 = ZoneService:createZone("NotCellTimeBoundaries", NOT_CELL_TIME, 15) -- Construct a zone called 'ZoneName' using 'group' and with an extended height of 15
- local CELL_TIME = workspace.Boundaries.CellTime -- A container (i.e. Model or Folder) of parts that represent the zone
- local zone_2 = ZoneService:createZone("CellTimeBoundaries", CELL_TIME, 15) -- Construct a zone called 'ZoneName' using 'group' and with an extended height of 15
- local function Between(input, num1, num2)
- if input >= num1 and input <= num2 then
- return true
- end
- end
- -- Zone 1 (Not Cell Time)
- zone_1.playerAdded:Connect(function(player)
- local char = player.Character or player.CharacterAdded:Wait()
- local innocent = player.PrisonerStats.Innocent
- local clockTime = game:GetService('Lighting').ClockTime
- if player.Team == game:GetService('Teams').Prisoners and not innocent.Value and not Between(clockTime, 0, 7) then
- print(player.Name,"entered the zone 1! Make player innocent. -- NOT CELL TIME")
- if char.Head:FindFirstChild('Not Innocent') then
- char.Head['Not Innocent']:Destroy()
- end
- player.PrisonerStats.Innocent.Value = true
- end
- end)
- zone_1.playerRemoving:Connect(function(player)
- local char = player.Character or player.CharacterAdded:Wait()
- local innocent = player.PrisonerStats.Innocent
- local clockTime = game:GetService('Lighting').ClockTime
- if player.Team == game:GetService('Teams').Prisoners and not char.Head:FindFirstChild('Not Innocent') and not Between(clockTime, 0, 7) then
- print(player.Name,"exited the zone 1! Make player guilty.")
- local UI = game.ReplicatedStorage.TSIC["Not Innocent"]:Clone()
- UI.Parent = char.Head
- innocent.Value = false
- end
- end)
- -- Zone 2 (Cell Time)
- zone_2.playerAdded:Connect(function(player)
- local char = player.Character or player.CharacterAdded:Wait()
- local innocent = player.PrisonerStats.Innocent
- local clockTime = game:GetService('Lighting').ClockTime
- if player.Team == game:GetService('Teams').Prisoners and innocent.Value and Between(clockTime, 0, 7) then
- print(player.Name,"entered the zone 2! Make player innocent. -- CELL TIME")
- if char.Head:FindFirstChild('Not Innocent') then
- char.Head['Not Innocent']:Destroy()
- end
- innocent.Value = true
- end
- end)
- zone_2.playerRemoving:Connect(function(player)
- local char = player.Character or player.CharacterAdded:Wait()
- local innocent = player.PrisonerStats.Innocent
- local clockTime = game:GetService('Lighting').ClockTime
- print(player.Name,"exited the zone 2! -- CELL TIME")
- if player.Team == game:GetService('Teams').Prisoners and not char.Head:FindFirstChild('Not Innocent') and Between(clockTime, 0, 7) then
- print(player.Name,"exited the zone 2! Make player guilty. -- CELL TIME")
- local UI = game.ReplicatedStorage.TSIC["Not Innocent"]:Clone()
- UI.Parent = char.Head
- innocent.Value = false
- end
- end)
- -- Main
- local zoneOneLooping = false
- local zoneTwoLooping = false
- while (true) do
- wait(0.5)
- local clockTime = game:GetService('Lighting').ClockTime
- if not Between(clockTime, 0, 7) and not zoneOneLooping and not zoneTwoLooping then -- Not CELLTIME and ZONE 1 not looping and ZONE 2 not looping
- print('1')
- zoneOneLooping = true
- zoneTwoLooping = false
- spawn(function()
- zone_1:initLoop()
- end)
- elseif not Between(clockTime, 0, 7) and zoneOneLooping then -- Not CELLTIME and ZONE 1 looping
- print('2')
- -- Do nothing
- elseif not Between(clockTime, 0, 7) and zoneTwoLooping then -- Not CELLTIME and ZONE 2 looping and ZONE 1 not looping
- print('3')
- zone_2:endLoop()
- zoneTwoLooping = false
- zoneOneLooping = true
- spawn(function()
- zone_1:initLoop()
- end)
- elseif Between(clockTime, 0, 7) and not zoneTwoLooping and not zoneOneLooping then -- CELLTIME and ZONE 2 not looping and ZONE 1 not looping
- print('4')
- zoneTwoLooping = true
- zoneOneLooping = false
- spawn(function()
- zone_2:initLoop()
- end)
- elseif Between(clockTime, 0, 7) and zoneTwoLooping then -- CELLTIME and ZONE 2 looping
- print('5')
- -- Do nothing
- elseif Between(clockTime, 0, 7) and zoneOneLooping and not zoneTwoLooping then -- CELLTIME and ZONE 1 looping and ZONE 2 not looping
- print('6')
- zone_1:endLoop()
- zoneTwoLooping = true
- zoneOneLooping = false
- spawn(function()
- zone_2:initLoop()
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement