Cuff/Grab system acting weird

The system is supposed to link the 2 characters together while keeping them at a certain distance from each other, but for some reason they glitch into each other. Is this normal and how can I change it? (I’ve never used welds before).

local RemoteEvent = script.Parent:WaitForChild("RemoteEvent")

function PlayerCuffed(Player, Target)
	print(Target)
	local IsPlayer = game.Players:GetPlayerFromCharacter(Target.Parent)
	local PlayerHasTool = Player.Backpack:FindFirstChild("Cuffs")
	if Target.Name == "Torso" or Target.Name == "HumanoidRootPart" and IsPlayer ~= nil and PlayerHasTool ~= nil then
		local CheckDistance = (Player.Character.HumanoidRootPart.Position - Target.Position).Magnitude
		if CheckDistance <= 10 then
			local Char = Target.Parent
			local Humanoid = Char:FindFirstChild("Humanoid")
			if Humanoid then
				local Anim = script.Parent:WaitForChild("ArrestPlayer")
				local AnimationTrack = Humanoid:LoadAnimation(Anim)
				AnimationTrack:Play()
				Char.HumanoidRootPart.Anchored = true
				local Weld = Instance.new("Weld")
				Weld.Parent = Char
				Weld.Part0 = Char.HumanoidRootPart
				Weld.Part1 = Player.Character.HumanoidRootPart
				Char.HumanoidRootPart.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
			end
		end
	end
end

RemoteEvent.OnServerEvent:Connect(PlayerCuffed)

I don’t have too much experience with welds either, so I’m just as lost as you. Have you tried using WeldConstraints rather than Welds, though? Try replacing Instance.new("Weld") with Instance.new("WeldConstraint") and let me know if it changes anything.


Both players can’t move for some reason, but it’s closer to what I want to achieve.

this is the issue. Either dont anchor it at all, or unanchor it at the end

Didn’t realize this before, but it looks like you’re welding both the HumanoidRootPart of the target and the person with the handcuffs. Because you’ve set one of the HumanoidRootParts to anchored, I believe that it’s causing both of them not to move. You could alternatively set the WalkSpeed to 0.

for the weld instance, the C0 and C1 needs to be manually set.
C0 and C1s are basically just offsets

1 Like

How are they supposed to be used? Weld.C0 = Char.PrimaryPart.CFrame?

not really offset mean an increasement or decreasement so just do like this

Weld.C0 = CFrame.new(0,1,0) -- this offsets the part0 in the weld by 1 stud on the y axis

Nothing changes.


Current script:

local RemoteEvent = script.Parent:WaitForChild("RemoteEvent")

function PlayerCuffed(Player, Target)
	print(Target)
	local IsPlayer = game.Players:GetPlayerFromCharacter(Target.Parent)
	local PlayerHasTool = Player.Backpack:FindFirstChild("Cuffs")
	if Target.Name == "Torso" or Target.Name == "HumanoidRootPart" and IsPlayer ~= nil then
		local CheckDistance = (Player.Character.HumanoidRootPart.Position - Target.Position).Magnitude
		if CheckDistance <= 10 then
			local Char = Target.Parent
			local Humanoid = Char:FindFirstChild("Humanoid")
			if Humanoid then
				local Anim = script.Parent:WaitForChild("ArrestPlayer")
				local AnimationTrack = Humanoid:LoadAnimation(Anim)
				AnimationTrack:Play()
				Char.HumanoidRootPart.Anchored = true
				local Weld = Instance.new("WeldConstraint")
				Weld.Parent = Char
				Weld.Part0 = Char.HumanoidRootPart
				Weld.Part1 = Player.Character.HumanoidRootPart
				Weld.C0 = CFrame.new(10,0,0)
				Weld.C1 = CFrame.new(10,0,0)
				Char.HumanoidRootPart.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
			end
		end
	end
end

RemoteEvent.OnServerEvent:Connect(PlayerCuffed)

Did you even read what we wrote? One of your humanoids is anchored, so both of them are unable to move

1 Like

Don’t anchor the Target and switch Part0 with Part1 like this:

Weld.Part0 = Player.Character.HumanoidRootPart
Weld.Part1 = Char.HumanoidRootPart

Yes, I tried removing it, but it screws up the entire weld.

Well if you dont anchor them then it’ll never work.
I think its well explained here: Understanding Assemblies that you cant anchor it.
→ try fixing what screws your script after you unanchor it

Like this

local RemoteEvent = script.Parent:WaitForChild("RemoteEvent")

function PlayerCuffed(Player, Target)
	print(Target)
	local IsPlayer = game.Players:GetPlayerFromCharacter(Target.Parent)
	local PlayerHasTool = Player.Backpack:FindFirstChild("Cuffs")
	if Target.Name == "Torso" or Target.Name == "HumanoidRootPart" and IsPlayer ~= nil then
		local CheckDistance = (Player.Character.HumanoidRootPart.Position - Target.Position).Magnitude
		if CheckDistance <= 10 then
			local Char = Target.Parent
			local Humanoid = Char:FindFirstChild("Humanoid")
			if Humanoid then
				local Anim = script.Parent:WaitForChild("ArrestPlayer")
				local AnimationTrack = Humanoid:LoadAnimation(Anim)
				AnimationTrack:Play()
				Char.Humanoid.Walkspeed = 0
				local Weld = Instance.new("WeldConstraint")
				Weld.Parent = Char
				Weld.Part0 = Player.Character.HumanoidRootPart
				Weld.Part1 = Char.HumanoidRootPart
				Weld.C0 = CFrame.new(10,0,0)
				Weld.C1 = CFrame.new(10,0,0)
				Char.HumanoidRootPart.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
			end
		end
	end
end

RemoteEvent.OnServerEvent:Connect(PlayerCuffed)

Im not very good at welding so i dont wanna suggest anything wrong about them. But i can say 100% that anchoring them wont achieve you what you wanna do. There is absolutely no way a player can move when he is anchored, or when he is welded to an anchored part.

Try to go to a server view(without stopping the game) after welding, and look at your explorer, to see if the welds are made correctly

1 Like

What you wanna use here is the C0 and C1 Property of the Weld Instance to define the offset between the two weld points. If you use C0 or C1 is completely irrelevant in your case. (Just use C1, it makes more sense).

You are also anchoring the HumanoidRootPart, why? Anchor completely removes physics of an object (ex. Collisions). BasePart.Anchored

On top of that there might be issues/collisions regarding the walking physics of the player who is cuffing, so setting the Humanoid State of the cuffed Character.Humanoid to Enum.HumanoidStateType.Physics. Remember to that before playing the animation, since I’m not sure if that stops the ongoing animations.


It’s still weird, but less weird…?

local RemoteEvent = script.Parent:WaitForChild("RemoteEvent")

function PlayerCuffed(Player, Target)
	print(Target)
	local IsPlayer = game.Players:GetPlayerFromCharacter(Target.Parent)
	local PlayerHasTool = Player.Backpack:FindFirstChild("Cuffs")
	if Target.Name == "Torso" or Target.Name == "HumanoidRootPart" and IsPlayer ~= nil then
		local CheckDistance = (Player.Character.HumanoidRootPart.Position - Target.Position).Magnitude
		if CheckDistance <= 10 then
			local Char = Target.Parent
			local Humanoid = Char:FindFirstChild("Humanoid")
			if Humanoid then
				local Anim = script.Parent:WaitForChild("ArrestPlayer")
				local AnimationTrack = Humanoid:LoadAnimation(Anim)
				AnimationTrack:Play()
				local Weld = Instance.new("Weld")
				Weld.Parent = Char.HumanoidRootPart
				Weld.Part0 = Player.Character.HumanoidRootPart
				Weld.Part1 = Char.HumanoidRootPart
				Weld.C1 = CFrame.new(10,0,0)
				Char.Humanoid.WalkSpeed = 0
				Char.Humanoid = Enum.HumanoidStateType.Physics
			end
		end
	end
end

RemoteEvent.OnServerEvent:Connect(PlayerCuffed)

I think that has to do with the mass of the characters.

How can I change the mass of a character?

to make the character of the person your handcuffing massless try to loop through every basepart of that character and make massless equal to true.

Here is what I mean, I am rusty so I might have done some mistakes. Try it out and comeback to me.

local RemoteEvent = script.Parent:WaitForChild("RemoteEvent")

function PlayerCuffed(Player, Target)
	print(Target)
	local IsPlayer = game.Players:GetPlayerFromCharacter(Target.Parent)
	local PlayerHasTool = Player.Backpack:FindFirstChild("Cuffs")
	if Target.Name == "Torso" or Target.Name == "HumanoidRootPart" and IsPlayer ~= nil then
		local CheckDistance = (Player.Character.HumanoidRootPart.Position - Target.Position).Magnitude
		if CheckDistance <= 10 then
			local Char = Target.Parent
			local Humanoid = Char:FindFirstChild("Humanoid")
            for_,v in pairs(Char:GetDescendants()) do
                  if v:IsA("BasePart") then
                      v.Massless = true
                  end
             end
			if Humanoid then
				local Anim = script.Parent:WaitForChild("ArrestPlayer")
				local AnimationTrack = Humanoid:LoadAnimation(Anim)
				AnimationTrack:Play()
				local Weld = Instance.new("Weld")
				Weld.Parent = Char.HumanoidRootPart
				Weld.Part0 = Player.Character.HumanoidRootPart
				Weld.Part1 = Char.HumanoidRootPart
				Weld.C1 = CFrame.new(10,0,0)
				Char.Humanoid.WalkSpeed = 0
				Char.Humanoid = Enum.HumanoidStateType.Physics
			end
		end
	end
end

RemoteEvent.OnServerEvent:Connect(PlayerCuffed)