Why is the player floating when they ragdoll?

Hello. So I’m trying to make a trip wire where when someone walks onto it they trip (ragdoll)
They ragdoll just fine but for some reason they float into the air as well.

Here is the script:

script.Parent.Touched:Connect(function(hit)
	
	local character = hit.Parent
	local humanoid = character:WaitForChild("Humanoid")
	
	humanoid.BreakJointsOnDeath = false
	humanoid.RequiresNeck=false
	humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	for _, v in pairs(character:GetDescendants()) do
		if v:IsA("Motor6D") then
			local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
			a0.CFrame = v.C0
			a1.CFrame = v.C1
			a0.Parent = v.Part0
			a1.Parent = v.Part1
			local b = Instance.new("BallSocketConstraint")
			b.Attachment0 = a0
			b.Attachment1 = a1
			b.Parent = v.Part0
			v.Enabled = false
		end
	end
	wait(1)
	for _,v in pairs(character:GetDescendants()) do
		if v:IsA('Motor6D') then
			v.Enabled = true
		end
		if v.Name == 'BallSocketConstraint' then
			v:Destroy()
		end
		if v.Name == 'Attachment' then
			v:Destroy()
		end
	end
	wait(1)
	humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
end)

Original Script credit goes to @tonyredgraveX

Thanks!

1 Like

I suggest you mess around with the humanoidstatetypes, I remember that this once helped me out. Also, make sure to set the PrimaryPart of the character to cancollide false.

1 Like

I deleted the HumanoidRootPart and that seemed to work

local function Ragdoll(Target)
	
	for index,joint in Target:GetDescendants() do
		if joint:IsA("Motor6D") then
			print(joint)
			joint.Parent.CanCollide = true
			local socket = Instance.new("BallSocketConstraint")
			local a1 = Instance.new("Attachment")
			local a2 = Instance.new("Attachment")
			a1.Parent = joint.Part0
			a2.Parent = joint.Part1
			socket.Parent = joint.Parent
			socket.Attachment0 = a1
			socket.Attachment1 = a2
			a1.CFrame = joint.C0
			a2.CFrame = joint.C1
			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true
			joint:Destroy()
		end
	end
	
	
	local Humanoid : Humanoid = Target:FindFirstChildOfClass("Humanoid")
	Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	Target.HumanoidRootPart:Destroy()
	Humanoid.RequiresNeck = false
	
end
1 Like