My character sinks into the ground

So I tried making a detain and every time I try to jump / sometimes when I walk I just sink into the ground.

This is the server code:

local remote = game.ReplicatedStorage.DetainEvent
remote.OnServerEvent:Connect(function(plr, target)
	if plr.Backpack:FindFirstChild("Detain") or plr.Character:FindFirstChild("Detain") then
		local Target = game.Players:GetPlayerFromCharacter(target)
		if Target.Character:FindFirstChild("Detain") then
			Target.Character.Detain:Destroy()
			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 = "Detain"
		Target.Character.Torso.CFrame = plr.Character.Torso.CFrame * CFrame.new(0,0.5,-5)
		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
			for i,v in pairs(TargetParts) do
				if v:IsA("Part") then
					v.Massless = true
				end
			end
		end
		
		
	end
end)
5 Likes

This is really old, I found it looking for the solution to my problem, but if anyone has the same problem as this guy, you have to change the PlatformStand of the victim’s Humanoid to true, and change the state of the victim’s Humanoid to physical and will be resolved.

2 Likes