Need help fixing Cuffs tool

Hi, the problem I’m facing is that the cuffs are really laggy when they move the character, I’m 90% I know why this happens but I have no clue how to fix it.
Anyone?

repeat wait() until game.ReplicatedStorage:FindFirstChild("DetainEvent")

local RemoteEvent = game.ReplicatedStorage.DetainEvent
local RunService = game:GetService("RunService")
local Enabled = {}

RemoteEvent.OnServerEvent:Connect(function(plr,purpose,mousetarget)
	if plr ~= nil and purpose == "detain" then
		if mousetarget.Parent:FindFirstChildOfClass("Humanoid") then
			if not mousetarget.Parent:FindFirstChild("Detain") then
				Enabled[plr.Name] = true
                    spawn(function()
					repeat
						mousetarget.Parent:FindFirstChildOfClass("Humanoid"):UnequipTools()
						if mousetarget.Parent:FindFirstChild("UpperTorso") then
							mousetarget.Parent.UpperTorso.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new( 0, 0, -5 )
						else
							mousetarget.Parent.Torso.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new( 0, 0, -5 )
						end
						RunService.Heartbeat:Wait()
					until Enabled[plr.Name] == false
				end)
			end
		else
			Enabled[plr.Name] = false
			RemoteEvent:FireClient(plr,"noOneToDetain")
		end
	elseif purpose == "undetain" then
		Enabled[plr.Name] = false
	end
end)

If you use Humanoid:ChangeState(Enum.HumanoidStateType.Physics) or set the PlatformStand property of the humanoid to true then it might help.

Assuming the humanoid of the cuffed target?

Instead of loop setting the cuffed players position why not just weld them to the player who cuffed them & make them massless?

2 Likes

Yes. Also, setting platform stand is easier but turns off collisions for the legs and stuff, so you you still want collisions for all the body parts, use ChangeState.

Well I have no idea how to do that.