Help with scripting weld, Handcuffs

Hello So I’ll be simple, sometimes my cuffs works 100% but other times, like if the weld was “laggy”
Sometimes it doesn’t lag’s and you can move and the other player moves too but not laggy, but this time, yep, it like it’s slow, anything else I could use except of weld? to make the player moves along with the officer cuffing him? Without using a loop! or anyway to improve my script?

How it should work: https://gyazo.com/e4adbd52e7649e8774b769c4697e55d4

How sometimes works (wrong): https://gyazo.com/074cc892a013eed74b118d535a7c4e49

function PinPlayer(Pinner, Pinned)
	if not Pinned.Character:FindFirstChild("Pinned")  then
		game.ReplicatedStorage.Events.Notifcation:FireClient(Pinned, "Cuffed", "LTAA Will result in 20 minutes of jail ", 10)
	local Value = Instance.new("ObjectValue", Pinned.Character)
	Value.Name = "Pinned"
tarr = Pinned
off = Pinner
	Pinned.Character.Humanoid.PlatformStand = true
	local aw = Pinned.Character.Humanoid:LoadAnimation(PinnedAnim)
	local Value2 = Instance.new("StringValue", Pinner.Character)
	Value2.Name = "Grabbing"
	aw:Play()
	Pinned.PlayerGui.Backpack.Enabled = false
	Pinned.PlayerGui.Backpack.Frame.LocalScript.Disabled = true
	local Cuffs = script.Cuffs:Clone();
		Cuffs.Parent = Pinned.Character;
		local CuffWeld = Instance.new("Weld", Cuffs);
		CuffWeld.Part0 = Cuffs.Union;
		CuffWeld.Part1 = Pinned.Character.UpperTorso;
		CuffWeld.C1 = CFrame.new(0,-0.8,1.50) * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0))
  local Weld = Instance.new("Weld", Pinner.Character)
	Weld.Name = "InteractWeld"
	Weld.Part0 = Pinner.Character.HumanoidRootPart
	Weld.Part1 = Pinned.Character.HumanoidRootPart
	Value.Value = Weld
	Value2.Value = Pinned.Name
	Pinned.Character.Humanoid:UnequipTools()
	Weld.C1 = CFrame.new(0,0,2.5)
	elseif Pinned.Character:FindFirstChild("Pinned") or Pinner.Character:FindFirstChild("InteractWeld")  then
		game.ReplicatedStorage.Events.Notifcation:FireClient(Pinned, "Released", "You're free to go.", 10)
			for i,v in pairs(Pinned.Character.Humanoid:GetPlayingAnimationTracks()) do
		v:Stop()
			end
			tarr = nil
off = nil

		 if Pinned.Character:FindFirstChild("Pinned") then
			Pinned.Character:FindFirstChild("Pinned"):Destroy()
		end
	   if Pinner.Character:FindFirstChild("Grabbing") or Pinner.Character:FindFirstChild("InteractWeld") or Pinned.Character:FindFirstChild("Pinned") then
		for i,v in pairs(Pinner.Character:GetChildren()) do
			if v.Name == "Pinned" or v.Name == "Grabbing" or v.Name == "InteractWeld" then
				v:Destroy()
			end
		 		end
		for i,v in pairs(Pinned.Character:GetChildren()) do
			if v.Name == "Pinned" or v.Name == "Grabbing" or v.Name == "InteractWeld" or v.Name == "Cuffs" then
				v:Destroy()
			end
 		end
	end
		Pinned.Character.Humanoid.WalkSpeed = 16
		Pinned.PlayerGui.Backpack.Enabled = true
		Pinned.PlayerGui.Backpack.Frame.LocalScript.Disabled = false
	   Pinned.Character.Humanoid.PlatformStand = false
	

	for i,v in pairs(Pinned.Character.Humanoid:GetPlayingAnimationTracks()) do
		v:Stop()
	end
	
	end
end

The important stuff it’s on the local “Weld” that’s what it lags

I think is because of this:

I mean, using “,” to parent your instance cause lag, you should use this instead:

local Weld = Instance.new("Weld")
Weld.Parent = Pinner.Character

Alright I’ll see :slight_smile: thx anyway

Nope not fixed yet :frowning: It didn’t worked

i didn’t understand very good both videos you showed, so sometimes you can’t unweld the player that you arrested?

No, sometimes the weld as you can see when I jump it lags or it’s slow

Maybe because the player is not massless? I don’t know, i’m not too good about that.

Could you add a place file to this? Might understand better to fetch those errors etc.

It’s that the script, and no errors

I don’t seem to see an issue in here.
It doesn’t seem logical to lag…

Three problems.

  • The other character’s humanoid still attempts to apply it’s own forces. This can cause various issues in regards to physics because whereas your character is applying movement forces, the other character is not applying the same force.

  • The other character is not network owned by the client. You are still two separate assemblies and now your client is trying to move another client. You have conflicting clients trying to wrestle control of physics of the entire mechanism (both your characters).

  • The character with the handcuffs does not move the other character locally. Ties in with the above point and the fact that any kind of server-side involvement for stuff involving intermediate items will typically result in choppy movement.

Take those, do some research and apply tests. Enough searching around will reveal how to see if any of these are part of the problem and how to diagnose them.

1 Like

So, should I add a weld client side? sorry I don’t understand, like I can’t find a solution, I’ve been searching :confused:

Is there any humanoid property, I used humanoid.PlatformStand

Or maybe using a body velocity that goes upwards?

How to temporarily disable all character input? - #2 by TheGamer101 Oh wait, I think this can help!

I still can’t find a solution :frowning: