Here is that script but in a code block. Next time please consider posting questions with a cod block.
001 | JailPos = script.Parent.JailPosition.Value |
003 | FreemanPosition = Vector 3. new( 5 , 4 , 191 ) |
005 | JailedFolder = script.Parent.JailedPlayers |
007 | function TeleportPlayer(Plyer,Pos) |
009 | if Plyer.Character ~ = nil then |
011 | local HMRP = Plyer.Character:FindFirstChild( "HumanoidRootPart" ) |
015 | HMRP.CFrame = CFrame.new(Pos) |
023 | function PlayerFromName(Nam) |
025 | local Search = game.Players:FindFirstChild(Nam) |
027 | if Search then return Search else return nil end |
031 | function GiveJailGui(Plyname) |
033 | local Play = PlayerFromName(Plyname) |
037 | if Play.PlayerGui then |
039 | local JG = script.JailedGui:Clone() |
041 | JG.Parent = Play.PlayerGui |
043 | JG.GUpdater.Disabled = false |
047 | function GiveFreemanGui(Plyname) |
049 | local Play = PlayerFromName(Plyname) |
053 | if Play.PlayerGui then |
055 | local FG = script.PlayerFree:Clone() |
057 | FG.Parent = Play.PlayerGui |
059 | FG.CloseScript.Disabled = false |
063 | function ClearName(PlyName) |
065 | local fin = JailedFolder:GetChildren() |
067 | for i = 1 ,#fin do if fin [ i ] .Name = = PlyName then |
075 | function HandleJailTime(PlyName,TimeToServe) |
079 | local Timer = Instance.new( "IntValue" ) |
083 | Timer.Parent = JailedFolder |
085 | Timer.Value = TimeToServe |
087 | coroutine.wrap( function () |
089 | for i = 1 ,TimeToServe do |
091 | Timer.Value = Timer.Value - 1 |
097 | Timer.Value = 0 wait( 1 ) Timer:Destroy() |
103 | function JailPlayer(Caller,PlyN) |
105 | local JPlayer = PlayerFromName(PlyN) |
109 | if JPlayer.Backpack then JPlayer.Backpack:ClearAllChildren() end |
111 | if not JPlayer.PlayerGui:FindFirstChild( "JailedGui" ) then |
113 | HandleJailTime(PlyN, 90 ) |
115 | TeleportPlayer(JPlayer,JailPos) |
123 | script.Parent.OnServerEvent:connect( function (Caller,Prisoner,format) |
125 | if Caller then if Prisoner ~ = nil then if format ~ = nil then |
127 | if format = = "Jail" then |
129 | JailPlayer(Caller,Prisoner) |
131 | elseif format = = "Confirm" then |
133 | local CGui = script.JConfirmGui:Clone() |
135 | local CopPGUI = Caller:FindFirstChild( "PlayerGui" ) |
139 | if not CopPGUI:FindFirstChild( "JConfirmGui" ) then |
143 | CGui.TargetPlayer.Value = Prisoner.Name |
145 | CGui.ArrestPlayer.Disabled = false |
149 | elseif format = = "Freeman" then |
151 | TeleportPlayer(Caller,FreemanPosition) |
153 | ClearName(Caller.Name) |
155 | GiveFreemanGui(Caller.Name) |
157 | elseif format = = "BackToJail" then |
159 | TeleportPlayer(Caller,JailPos) |
161 | elseif format = = "BackToJailNP" then |
163 | TeleportPlayer(Caller,JailPos) |
165 | GiveJailGui(Caller.Name) |
167 | elseif format = = "ClearJGUIs" then |
169 | local ser = Caller:FindFirstChild( "PlayerGui" ) if ser then |
171 | local search = ser:GetChildren() |
175 | if search [ i ] .Name = = "JConfirmGui" or search [ i ] .Name = = "JailedGui" or search [ i ] .Name = = "PlayerFree" then |
I did not format anything from the script but only made it have a code block.