Hello there. I’ll try to make this quick a simple. I already have a working handcuff system that I made which handcuffs a person, un-handcuffs them, grabs them, and releases them. Although it is working, there are a couple of flaws with it. These flaws come down to the grabbing system.
The first flaw is the lag produced when a player is grabbing another player and the cuffed player is moving. Although I do set the NetworkOwnership of all player’s body parts to the player grabbing them, the player is still applying their forces. Of course, when grabbed I do put the player in platform stand, but if they gain the ability of control, then it creates this “lagging” effect and it’s hard to control.
The second flaw is a death chain effect. Basically, when one of the players dies, the other one (either grabbing or being grabbed) dies as well. I am assuming that is caused because of the BreakJoints() function that runs whenever a player dies, but I am not very sure.
I know that there are similar posts, but they don’t really answer my main question which is, what is the most effective way to make a handcuff system? In my handcuff system, I use a weld which is placed inside the player being grabbed and is causing this issue. The weld is linked between the two players’ HumanoidRootPart. I am remaking a whole new system, and would like to know if there is a more efficient way of simulating the “grab” effect without having to disable their movement whatsoever. I know it is possible to do this some way, as I have seen it in other games like New Haven County, which uses something that has to do with NetworkOwnership. I also had the idea of using CFrame to move the player, but I don’t know how well that will work because it’s probably going to be using a lot of resources.
Here is the code so you can take a better look at it and understand it better:
local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid") local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") local TargetCharacter = Target.Character local TargetHumanoid = TargetCharacter:WaitForChild("Humanoid") local TargetHumanoidRootPart = TargetCharacter:WaitForChild("HumanoidRootPart") local PlayerArrestData = HumanoidRootPart:WaitForChild("ArrestData") local TargetArrestData = TargetHumanoidRootPart:WaitForChild("ArrestData")
(Player is the player that is grabbing and Target is the player being grabbed)
if TargetArrestData:WaitForChild("IsCuffed").Value == true then if TargetArrestData:WaitForChild("GrabbedBy").Value == nil then local Weld = Instance.new("Weld") Weld.Part0 = HumanoidRootPart Weld.Part1 = TargetHumanoidRootPart Weld.C0 = CFrame.new(1.5, 0, -2.75) Weld.Name = "CuffWeld" Weld.Parent = HumanoidRootPart TargetHumanoid.WalkSpeed = 0 TargetHumanoid.JumpPower = 0 if TargetHumanoid.Sit == true then TargetHumanoid.Sit = false end TargetHumanoid.PlatformStand = true TargetArrestData:WaitForChild("GrabbedBy").Value = Player PlayerArrestData:WaitForChild("Grabbing").Value = Target local function SetNetworkOwnership(Father) for i, v in pairs(Father:GetChildren()) do if v:IsA("BasePart") then v:SetNetworkOwner(Player) v.Massless = true end if #v:GetChildren() > 0 then SetNetworkOwnership(v) end end end SetNetworkOwnership(Target.Character) end end
If you have any ideas, please let me know below. Thank you for your time and effort.