Roblox Tutorial - How to make "drag" cuffs for R6/R15 (SourceCode)

ArrestMechanics:

local ReplicatedStorage = game:GetService("ReplicatedStorage").ArrestSystem

local ArrestUser = ReplicatedStorage:WaitForChild("ArrestUser")
local ReleaseUser = ReplicatedStorage:WaitForChild("ReleaseUser")
local AntiReset = ReplicatedStorage:WaitForChild("AntiReset")




---Main



local function AntiResetF(PlayerInstance, Status)
	AntiReset:FireClient(PlayerInstance, Status)
end

local function ReleaseUserF(Player)
	local P2 = Player.Character.HumanoidRootPart.CuffWeld.Part1
	local P2Instance = game.Players:FindFirstChild(P2.Parent.Name)

	Player.Character.HumanoidRootPart.CuffWeld:Destroy()
	
	for i,v in ipairs(P2.Parent:GetDescendants()) do 
		if v:IsA("MeshPart") then
			v.Massless = false
		end
	end
	
	P2.Parent.Humanoid.WalkSpeed = 16
	P2.Parent.Humanoid.JumpPower = 50
	
	P2.Parent.Humanoid.PlatformStand = false

	AntiResetF(P2Instance, true)
end

ArrestUser.OnServerEvent:Connect(function(Player, Victim)
	local PlayerInstance = game.Players:FindFirstChild(Victim.Parent.Name)	
	local P1 = Player.Character.HumanoidRootPart
	local P2 = Victim
	
	
	local offset = Vector3.new(0,0.015,-5)
	Victim.CFrame = P1.CFrame*CFrame.new(offset)

	local NewConstraint = Instance.new("WeldConstraint")
	NewConstraint.Parent = P1

	NewConstraint.Part0 = P1
	NewConstraint.Part1 = P2
	NewConstraint.Name = "CuffWeld"
	
	P2.Parent.Humanoid.PlatformStand = true
	
	Victim.Parent.Humanoid.WalkSpeed = 0
	Victim.Parent.Humanoid.JumpPower = 0 	
	
	for i,v in ipairs(Victim.Parent:GetDescendants()) do 
		if v:IsA("MeshPart") then
			v.Massless = true
		end
	end
	
	AntiResetF(PlayerInstance, false)
	print("Arrest")
end)


ReleaseUser.OnServerEvent:Connect(function(Player)
	ReleaseUserF(Player)
end)

Handler:

local ReplicatedStorage = game:GetService("ReplicatedStorage").ArrestSystem
local Players = game:GetService("Players")

local tool = script.Parent
local client = Players.LocalPlayer
local cursor = client:GetMouse()

local SomebodyArrested = false 

local ArrestUser = ReplicatedStorage:WaitForChild("ArrestUser")
local ReleaseUser = ReplicatedStorage:WaitForChild("ReleaseUser")
local AntiReset = ReplicatedStorage:WaitForChild("AntiReset")




--Tool checker


tool.Activated:Connect(function()
	local Target = cursor.Target
	if Target then
		local Victim = Target.Parent:FindFirstChild("HumanoidRootPart")
		if Victim and SomebodyArrested == false then
			SomebodyArrested = true
			ArrestUser:FireServer(Victim)
		else
			if SomebodyArrested == true then
				ReleaseUser:FireServer()
				SomebodyArrested = false
			end
		end
	end
end)


Anti Reset:

local StarterGui = game:GetService('StarterGui')
local ReplicatedStorage = game:GetService("ReplicatedStorage").ArrestSystem
local AntiReset = ReplicatedStorage:WaitForChild("AntiReset")


AntiReset.OnClientEvent:Connect(function(status)
	StarterGui:SetCore("ResetButtonCallback",status)
end)

Cuff Giver:

local GroupId = 10392184
local MinRank = 2

game.Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(GroupId) >= MinRank then
		wait(5)
		local Cloned_Tool = game.ReplicatedStorage.ArrestSystem.Model.Cuffs:Clone()
		Cloned_Tool.Parent = Player.Backpack
	end
end)

Download the model: CuffTool.rbxm (2.8 KB)


If you have any issues feel free to make a topic in #scripting-support!

1 Like

This topic was automatically closed 1 minute after the last reply. New replies are no longer allowed.