Problems with jumping while detaining player. Any fix?

So I made a detain and everything about it works but when you try to jump your character loses all the speed and you stop just to jump. Do you guys have any fix?
LocalScript:

local Event = game.ReplicatedStorage.DetainEvent
local tool = script.Parent
local IsDetaining = false
local Detainedplr = nil
tool.Equipped:Connect(function(m)
	print("X:"..m.X.." ".."Y:"..m.Y)
	m.Button1Down:Connect(function()
		print(m.Target.Name)
		if m.Target.Name == "Head" or m.Target.Name == "Torso"  or m.Target.Name == "HumanoidRootPart" or m.Target.Name == "Left Arm" or m.Target.Name == "Right Arm" or m.Target.Name == "Left Leg" or m.Target.Name == "Right Leg" then
			if m.Target.Parent:FindFirstChild("Humanoid") then
				Event:FireServer(m.Target.Parent, true)
				IsDetaining = true
				Detainedplr = m.Target.Parent
				print(m.Target.Parent.Name)
			end
		else
			print("A")
			if Detainedplr ~= nil then
				print("Undetaining")
				Event:FireServer(Detainedplr, true)
				IsDetaining = false
				Detainedplr = nil
			end
			
		end
	end)
end)

ServerScript

local remote = game.ReplicatedStorage.DetainEvent
remote.OnServerEvent:Connect(function(plr, target, detain)
	if plr.Backpack:FindFirstChild("Detain") or plr.Character:FindFirstChild("Detain") then
		Target = game.Players:GetPlayerFromCharacter(target)
		
		if detain then
			if plr.Character:FindFirstChild("DetainWeld") then
			print("Cannot detain while being detained!")
		else
			if Target.Character:FindFirstChild("DetainWeld") then
			Target.Character.DetainWeld:Destroy()
			Target.Character.Humanoid.HipHeight = 0
			for i,v in pairs(TargetParts) do
				if v:IsA("Part") then
					v.Massless = false
				end
			end
		else
			local Weld = Instance.new("Weld")
			TargetParts = Target.Character:GetChildren()
		Weld.Name = "DetainWeld"
		Target.Character.Humanoid.HipHeight = 1
		Target.Character.Torso.CFrame = plr.Character.Torso.CFrame * CFrame.new(0,1,-5)
		Target.Character.Humanoid.HipHeight = 1
		Weld.Part0 = plr.Character.Torso
		Weld.Part1 = Target.Character.Torso
		Weld.C0 = plr.Character.Torso.CFrame:Inverse()
		Weld.C1 = Target.Character.Torso.CFrame:Inverse()
		Target.Character.HumanoidRootPart.Massless = true
		Weld.Parent = Target.Character
		Target.Character.Humanoid.HipHeight = 1
			for i,v in pairs(TargetParts) do
				if v:IsA("Part") then
					v.Massless = true
				end
			end
		end
		
		
	end
		end
		else
			Target.DetainWeld:Destroy()
		end
		
		
end)

The issue visualised:

Change the Humanoid’s jumppower to 0 while detained.

Target.Character.Humanoid.JumpPower = 0
1 Like

Nope didn’t work still the same problem.

Is the detainee the one jumping?

After messing with the detainee on the server. Checking platform stand works.

1 Like