This system works fine with one of the players, but when another player tries to cuff it’s really laggy.
Player 1
robloxapp-20240109-0123016.wmv (1.5 MB)
Player 2
robloxapp-20240109-0126336.wmv (2.4 MB)
Server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage").ArrestSystem
local ArrestUser = ReplicatedStorage:WaitForChild("ArrestUser")
local ReleaseUser = ReplicatedStorage:WaitForChild("ReleaseUser")
local AntiReset = ReplicatedStorage:WaitForChild("AntiReset")
local function AntiResetF(PlayerInstance, Status)
AntiReset:FireClient(PlayerInstance, Status)
end
local function ReleaseUserF(Player)
local P2 = Player.Character:FindFirstChild("HumanoidRootPart").CuffWeld.Part1
local P2Instance = game.Players:FindFirstChild(P2.Parent.Name)
Player.Character:WaitForChild("HumanoidRootPart"):WaitForChild("CuffWeld"):Destroy()
for i, v in pairs(P2.Parent:GetChildren()) do
if v:IsA("BasePart") 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
print(PlayerInstance)
Victim.CFrame = P1.CFrame * CFrame.new(0,.1,-2.5)
local NewConstraint = Instance.new('WeldConstraint', P1)
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
Victim.Parent.Humanoid.Sit = false
P1.Parent.Humanoid.Sit = false
for i, v in pairs(Victim:GetChildren()) do
if v:IsA("BasePart") then
v.Massless = false
end
end
AntiResetF(PlayerInstance, false)
print("Arrest")
end)
ReleaseUser.OnServerEvent:Connect(function(Player)
ReleaseUserF(Player)
end)