Advertisement
SkidScripts

ER:LC Auto-Arrest

Feb 27th, 2022
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Protected_by_MoonSecV2 Discord = https://discord.gg/Werjnku2Wh
  2.  
  3.  
  4. pcall(function()
  5. repeat wait() until game:IsLoaded()
  6. local plr = game.Players.LocalPlayer
  7. local function ArrestPlayer(target)
  8.    local count = 0
  9.    while target.Character.Humanoid.WalkSpeed > 0 and target.Character.Humanoid.Health > 0.1 and target:FindFirstChild("Is_Wanted") and count < 50 do
  10.        count = count + 1
  11. wait(0.1)
  12. plr.Character:SetPrimaryPartCFrame(target.Character.PrimaryPart.CFrame)
  13. local args = {
  14.    [1] = "Handcuff",
  15.    [2] = target
  16. }
  17. game:GetService("ReplicatedStorage").FE.Handcuffs:InvokeServer(unpack(args))
  18. end
  19. wait()
  20. local args = {
  21.    [1] = "Arrest",
  22.    [2] = target
  23. }
  24.  
  25. game:GetService("ReplicatedStorage").FE.Handcuffs:InvokeServer(unpack(args))
  26. end
  27. local function GetWantedPlayers()
  28.    local wanted = {}
  29.    for _, a in pairs(game.Players:GetPlayers()) do
  30.        if a:FindFirstChild("Is_Wanted") then
  31.            table.insert(wanted, a)
  32.        end
  33.    end
  34.    return wanted
  35. end
  36. if #GetWantedPlayers() > 0 then
  37.    if plr.Team.Name ~= "Police" then
  38.        local args = {
  39.            [1] = BrickColor.new(102),
  40.            [2] = tostring(math.random(1000, 9999))
  41.        }
  42.        game:GetService("ReplicatedStorage").FE.TeamChange:FireServer(unpack(args))
  43.        wait(6)
  44.    end
  45.    if plr.Team.Name == "Police" then
  46.        for i, v in pairs(GetWantedPlayers()) do
  47.            if v.Character.PrimaryPart then
  48.                ArrestPlayer(v)
  49.            end
  50.        end
  51.    end
  52. end
  53. print("finished")
  54. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement