Is there a better way to handcuff someone without welding them together?

I have this problem where my player gets stuck every so often whenever I cuff someone. I asked around and people said it is a NetworkOwnership issue.

What I want it to do:
I want this script to detain the player so he or she can be searched or fined.

Problem:
https://gyazo.com/ad58cc3b06e40744f446efe049a9b6bd
Every so often I get stuck or the detained player can move me around.

Script:

local RemoteEvent = script.Parent.RemoteEvent
local Using = false
local TargetTorso
local weld

function CheckForChar(Part)
	if Part.Parent:IsA('Model') and Part.Parent:FindFirstChildOfClass('Humanoid') then
		local Char = Part.Parent
		TargetTorso = Char:WaitForChild("HumanoidRootPart") 
		return Char
	end
end

function CheckForTorso(player)
	local Char = player.Character
	if Char:FindFirstChild('Torso') then
		return Char.Torso
	else 
		return Char.UpperTorso
	end
end

RemoteEvent.OnServerEvent:Connect(function(player, one, two)
	if one == 'Cuff' then
		local Target = CheckForChar(two)		
		local PlayerTorso = CheckForTorso(player)
		
		if Target then
			Using = true
			RemoteEvent:FireClient(player,'Use')
			
			weld = Instance.new("Weld")
            weld.Part0 = PlayerTorso
            weld.Part1 = TargetTorso
            weld.C0 = CFrame.new(0,0,-3.5)
            weld.Parent = PlayerTorso
		end
	elseif one == 'UnCuff' then
		Using = false
        weld:Destroy()
		script.RunCuff.isOn.Value = false
		script.Parent.CuffedPlr.Value = ""
	end
end)

script.Parent.Unequipped:Connect(function()
	if weld ~= nil then
		weld:Destroy()
		script.RunCuff.isOn.Value = false
		TargetTorso.CanCollide = true
		Using = false
		script.Parent.CuffedPlr.Value = ""
	end
end)

Thanks in advance.

1 Like

I’m no programmer myself so I am not the best to ask and I don’t know what your end goal is here but maybe I could suggest making it an animation instead?

2 Likes

It’s a handcuff/detain script.

2 Likes

Will changing the CFrame value of the player slightly help any? What are you talking about “getting stuck”? If the player is dealing with collisions at all, moving the player will help. This might be a bit beyond my experience.

2 Likes

There can be two issues with your cuff model.

  1. It could have mass and mess with the player to avoid this you would set the massless value in every part of the cuff true(with no mass to the cuff, the weld won’t drag the player)

  2. Your cuff could have collided on, best to turn it off so that the player mesh won’t collide with the cuff model

Make sure to do both of these things. If you have a question about how to do this you can simply ask me and I’ll make a example script to do this

1 Like

Just edited, there is a gif of the issue.

Didn’t work, I tried both methods issue is still present.

Can you should me a gif of your cuff breaking so I get a better idea of what happening?

https://gyazo.com/ad58cc3b06e40744f446efe049a9b6bd

I think that’s the same gif.

1 Like

It is, this is the issue.

OK. If (from my understanding) the two players are welded together, then maybe the problem lies with physics itself. It looks like you are literally pushing the player. Maybe solve this by making the CFrame value of the victim player an offset of your players current position. Again, I may have no idea what I’m talking about. I’m just throwing something out there.

1 Like

I actually created a “detain” or handcuff tool for one of the groups I was formerly associated with, or rather was familiar with how it worked. Originally it was a LocalScript HopperBin by Ethancomputermad, all we did was turn it around to be FilteringEnabled.

Essentially, what the tool does is anchor and offset the HumanoidRootPart of the victim about 2.5 studs in front of the handler that’s using the tool. Sometimes, we meet edge cases when people reset or something else unintended happens, though that seems to work alright.

Our model isn’t exactly the best, but you’d definitely want to go for some kind of root part offsetting.

1 Like

Wouldn’t I need to keep the CFrame updated, if so how would I do that?

Try setting the cuffed player to his PlatformStand state. When a player is set to this, they can’t run(or move by itself) in any way and makes all of their body non-collidable except the humanoidrootpart.

if Target then
			Using = true
			RemoteEvent:FireClient(player,'Use')
			
            local CuffedUser = TargetTorso.Parent
            local CuffedUserHumanoid = CuffedUser:WaitForChild("Humanoid")
            
           CuffedUserHumanoid.PlatformStand = true
			
            weld = Instance.new("Weld")
            weld.Part0 = PlayerTorso
            weld.Part1 = TargetTorso
            weld.C0 = CFrame.new(0,0,-3.5)
            weld.Parent = PlayerTorso
		end

of couse you have to make sure you disable PlatformStand when you let go of the player

1 Like

Maybe when you cuff the person, disable their walking, turn off all their collisions, and change the hip height?

Yea, that what I basically said. Lol

1 Like

Use a loop of some kind. You can either use a while condition do loop or something from the RunService. (BindTo)RenderStep(ped) for the client, Stepped for the server.

2 Likes

I don’t think this way is really efficient. You doing a while loop on the server constantly as long as you holding that player, updating his position every frame. When I look at the gif again, it looks like the player is somewhat getting stopped from colliding with something. To stop all collisions with a player you would set PlatformStand on the user to true. This not only makes every part of the user non-collidable but also stops him from moving on his own and you can still play animations while in this State.

1 Like

I think you’re looking too much into it. Offsetting a HumanoidRootPart is not a complex operation nor is there anything inefficient actually happening here. Inefficient loops are when you run expensive functions very quickly at small intervals.

PlatformStand has no bearing on collisions and animations can be played outside of PlatformStand as well. Player movement is input and can be disabled by sinking input on the client.

Collisions can be nullified using collision groups. PlatformStand basically makes characters “limp” - it was intended for skateboards. It sets the Humanoid to the Freefaling state.