Tool Breaks When Player Ragdolled

Hello everyone, I have noticed that when I use this ragdoll script:

local function BreakBones(Character)
	for index, joint in pairs(Character:GetDescendants()) do
		if joint:IsA("Motor6D") and joint.Name ~= 'RightGrip' then
			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
	
	Character.Humanoid.PlatformStand = true
	Character.Humanoid.WalkSpeed = 0


	task.delay(2, function()
		for index, socket in pairs(Character:GetDescendants()) do
			if socket:IsA("BallSocketConstraint") then
				local attachment0 = socket.Attachment0
				local attachment1 = socket.Attachment1
				local part0 = attachment0.Parent
				local part1 = attachment1.Parent

				local motor = Instance.new("Motor6D")
				motor.Part0 = part0
				motor.Part1 = part1
				motor.C0 = attachment0.CFrame
				motor.C1 = attachment1.CFrame
				motor.Parent = part0

				socket:Destroy()
				attachment0:Destroy()
				attachment1:Destroy()
			end
		end
		
		Character.Humanoid.PlatformStand = false
		Character.Humanoid.WalkSpeed = 16
	end)
end

the handle of a tool flings out of the player’s hand and doesn’t come back and eventually tool is deleted from player’s inventory even though its supposed to not delete the RightGrip weld.

1 Like

The tool is being deleted due to it being flung outside the map, it falls beyond the limit of where a part can “live”

Your issue will probably come from a vital weld being destroyed for the tool

1 Like

What weld could it be?
(30c.har)

Taking a look it would be
RightGrip & RightGripAttachment

I believe?, Try excluding all attachments / welds inside of RightHand

I used R15 as a disclaimer ^

1 Like

I made it only run if joint.Parent.Name ~= ‘RightHand’ but it still has the same glitch:

local function BreakBones(Character)
	for index, joint in pairs(Character:GetDescendants()) do
		if joint:IsA("Motor6D") and joint.Parent ~= 'RightHand' then
			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

	Character.Humanoid.PlatformStand = true
	Character.Humanoid.WalkSpeed = 0

	task.delay(2, function()
		for index, socket in pairs(Character:GetDescendants()) do
			if socket:IsA("BallSocketConstraint") then
				local attachment0 = socket.Attachment0
				local attachment1 = socket.Attachment1
				local part0 = attachment0.Parent
				local part1 = attachment1.Parent

				local motor = Instance.new("Motor6D")
				motor.Part0 = part0
				motor.Part1 = part1
				motor.C0 = attachment0.CFrame
				motor.C1 = attachment1.CFrame
				motor.Parent = part0

				socket:Destroy()
				attachment0:Destroy()
				attachment1:Destroy()
			end
		end

		Character.Humanoid.PlatformStand = false
		Character.Humanoid.WalkSpeed = 16
	end)
end

Youll need to specify this one aswell i believe?

or try
join.Name == "RightHand" or joint.Name == "RightGripAttachment" then continue end

1 Like

For some reason it still has same issue:

local function BreakBones(Character)
	for index, joint in pairs(Character:GetDescendants()) do
		if joint:IsA("Motor6D") then
			if joint.Name == "RightHand" or joint.Name == "RightGripAttachment" then continue end
			
			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

	Character.Humanoid.PlatformStand = true
	Character.Humanoid.WalkSpeed = 0

	task.delay(2, function()
		for index, socket in pairs(Character:GetDescendants()) do
			if socket:IsA("BallSocketConstraint") then
				local attachment0 = socket.Attachment0
				local attachment1 = socket.Attachment1
				local part0 = attachment0.Parent
				local part1 = attachment1.Parent

				local motor = Instance.new("Motor6D")
				motor.Part0 = part0
				motor.Part1 = part1
				motor.C0 = attachment0.CFrame
				motor.C1 = attachment1.CFrame
				motor.Parent = part0

				socket:Destroy()
				attachment0:Destroy()
				attachment1:Destroy()
			end
		end

		Character.Humanoid.PlatformStand = false
		Character.Humanoid.WalkSpeed = 16
	end)
end

Hm, unsure what the issue could be then, try just monitoring what joints are removed and diagnose which joints break the tool

1 Like

The joint causing it to break was RootJoint

1 Like

What’s probably happening is that when you destroy the RootJoint, it’s detaching the HumanoidRootPart from the rest of the character, which can mess with the physics and basically yeet the tool outta the player’s hand.

Instead of skipping based on joint.Name == "RightHand" or "RightGripAttachment", you might wanna skip "RootJoint" too — like, just add that to your conditional so it doesn’t get destroyed. That joint is kinda vital for keeping everything grounded (literally), and removing it can send the whole character into chaos, including the stuff welded to them.

So just tweak your if to something like:

if joint:IsA("Motor6D") and not (joint.Name == "RightGrip" or joint.Name == "RootJoint") then

Or even better, build a list of joints to ignore so it’s easier to manage:

local ignoreJoints = {
    RightGrip = true,
    RootJoint = true,
    -- add any others you find important
}

if joint:IsA("Motor6D") and not ignoreJoints[joint.Name] then
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.