--# Services local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") --# Variables local Player = Players.LocalPlayer local Fe = ReplicatedStorage:FindFirstChild("FE") local UseHandcuffs = Fe and Fe:FindFirstChild("UseHandcuffs") local ToggleRagdoll = Fe and Fe:FindFirstChild("ToggleRagdoll") --# Functions local function IsInDistance(Vec1: Vector3, Vec2: Vector3, Dist: number): boolean return (Vec1 - Vec2).Magnitude <= Dist end local function EquipTool(ToolName: string, Existing: boolean) local success, result = pcall(function(Backpack: Backpack, Character: Model?) local Tool = Backpack:FindFirstChild(ToolName) local Humanoid = Character and Character:FindFirstChildOfClass("Humanoid") if Existing and not Tool then error("Tool doesn't exist!") end Humanoid:UnequipTools() Humanoid:EquipTool(Tool) end, Player.Backpack, Player.Character) --print(success, result) | Not required, just an habbit. return success end local function HasToolInToolbar(ToolName: string): boolean local Tool = Player.Character and Player.Character:FindFirstChild(ToolName) return (Tool and Tool:IsA("Tool")) or false end local function GetPositionOfModel(Model: Model?): Vector3? return (Model ~= nil and Model:GetPivot().Position) or nil end local function IsPlayerLocal(Player: Player): boolean return Player == Players.LocalPlayer end local function IsPlayerInTeam(Player: Player, Team: string): boolean return (Player.Team and Player.Team.Name == Team) or false end if _G.Loops then _G.Loops = false _G.Loops = nil end _G.Loops = false while _G.Loops do EquipTool("Handcuffs", true) if HasToolInToolbar("Handcuffs") then for _, user in Players:GetPlayers() do if (not IsPlayerLocal(user) and IsPlayerInTeam(user, "Civilian")) then if Player.Character and user.Character then local p1 = GetPositionOfModel(Player.Character) local p2 = GetPositionOfModel(user.Character) if IsInDistance(p1, p2, 900) and HasToolInToolbar("Handcuffs") then Player.Character.PrimaryPart.Anchored = false ToggleRagdoll:InvokeServer() Player.Character:PivotTo( user.Character:GetPivot() ) ToggleRagdoll:InvokeServer() EquipTool("Handcuffs", true) Player.Character.PrimaryPart.Anchored = true UseHandcuffs:InvokeServer("Handcuff", user) UseHandcuffs:InvokeServer("Arrest", user) else -- Statement isn't 100% accurate, e.g either in distance or handcuffs isn't valid, therefore pass. continue end end end end end task.wait() end