Welding/mass issue

Basically, I’m making a detain/handcuff system whenever the play cuffs/welds onto a player the player who cuffed them has slow movement and can barely walk.


remote.OnServerEvent:Connect(function(Player, findplayer)
	local attachplayer = Instance.new("Weld")
	attachplayer.Name = "Weld"..findplayer.Name
	attachplayer.Parent = workspace.DetainWelds
	attachplayer.Part0 = Player.Character.HumanoidRootPart
	attachplayer.Part1 = findplayer.Character.HumanoidRootPart
	attachplayer.C1 = CFrame.new(0, 0, 4)
	findplayer.Character.Humanoid.WalkSpeed = 0
	findplayer.Character.Humanoid.JumpPower = 0
	findplayer.Character.Humanoid.PlatformStand = false
	remote3:FireClient(findplayer, Player)
end)

heres a video clip of it happening
https://gyazo.com/16cc1593301597e59c2acbeed4bd70f4

I’m not entirely sure, but this is probably because the detainer has to carry the mass of the detained. You can try updating the detained players HumanoidRootPart relative to the detainer’s every second instead of using welds

how would i fix the mass? I tried to make the character of the detained massless still doesnt work

Making the detained player massless can cause problems or not work at all, I advise using a loop to set the detained player’s HumanoidRootPart a few studs in front of the detainer’s HumanoidRootPart

how so would i do that? a while true do loop?

Yes, however you shouldn’t check too often (a wait time of 0.5 should be fine) and it should break when the detained status ends

how would i exactly set the player a few studs would i use a cframe?

not so sure if this would work or not but you could set the detained’s parts to massles

Something like DetainedHRP.CFrame = DetainerHRP.CFrame * CFrame.new(0,0,-5)

I attempted that, no success same result

While trying a script like this, I found out that 0.5 is not enough. You should use a time between 0.05 and 0.2

it would probably be best to use RunService.RenderStepped for something like that

Not really working

	while true do
		wait(0.05)
		findplayer.Character.CFrame = Player.Character.CFrame * CFrame.new(0,0,-5)
	end

That would work the best, but I dont think setting it ~60 times a second is needed

Can you send the rest of the script?


remote.OnServerEvent:Connect(function(Player, findplayer)
	local attachplayer = Instance.new("Weld")
	attachplayer.Name = "Weld"..findplayer.Name
	attachplayer.Parent = workspace.DetainWelds
	attachplayer.Part0 = Player.Character.HumanoidRootPart
	attachplayer.Part1 = findplayer.Character.HumanoidRootPart
	attachplayer.C1 = CFrame.new(0, 0, 4)
	findplayer.Character.Humanoid.WalkSpeed = 0
	findplayer.Character.Humanoid.JumpPower = 0
	findplayer.Character.Humanoid.PlatformStand = false
	remote3:FireClient(findplayer, Player)
	while attachplayer.Parent == workspace.DetainWelds do
		wait(0.05)
		findplayer.Character.CFrame = Player.Character.CFrame * CFrame.new(0,0,-5)
	end
end)
  1. Don’t create a weld
  2. You are trying to set and read the CFrame of the player’s character, which is a model. Use HumanoidRootPart instead
remote.OnServerEvent:Connect(function(Player, findplayer)
	while script.Parent == game.ServerScriptService do
		wait(0.05)
		findplayer.Character.HumanoidRootPart.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
	end
	remote3:FireClient(findplayer, Player)
end)

like this?

edit:
that works very well actually

You should check if the HRP exists, also add these three lines back:

findplayer.Character.Humanoid.WalkSpeed = 0
findplayer.Character.Humanoid.JumpPower = 0
findplayer.Character.Humanoid.PlatformStand = false

How would I uncuff the player/reverse the action