Ragdoll not appearing if I shoot, but shows if I use a sword

Below, you can see that Billy (the player who was shot) died, however, his ragdoll is not appearing. Even weirder, his idle animations are playing when it shouldn’t.

Warnings after I shoot:

Client:

local mouse = game.Players.LocalPlayer:GetMouse()

mouse.Button1Down:Connect(function()
	script.Parent.FireWeapon:FireServer(mouse.Hit.p)
end)

Server:

script.Parent.FireWeapon.OnServerEvent:Connect(function(player, mousePosition)
	local raycastParams = RaycastParams.new()
	raycastParams.FilterDescendantsInstances = {player.Character}
	raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
	
	local raycastResult = workspace:Raycast(script.Parent.Handle.Position, (mousePosition - script.Parent.Handle.Position)*300, raycastParams)
	
	if raycastResult then
		local hitPart = raycastResult.Instance
		local model = hitPart:FindFirstAncestorOfClass("Model")
		
		if model then
			if model:FindFirstChild("Humanoid") then
				model.Humanoid.Health -= 100
			end
		end
	end
end)

I do believe it has to do with the local script, would anyone know the issue that’s causing this? The sword, that only uses server code, works and shows the ragdoll.

2 Likes

I’ve created my own gun script, yet the issue is still appearing. Would anyone know why?

1 Like

I don’t see where you’re applying a ragdoll effect here?

It’s in a different script, here is the code:

local function ConnectLimbs(char)
		for i, limb in pairs(char:GetChildren()) do
			if limb:IsA("BasePart") then
				local atch0, atch1, atch2, atch3, atch4, atch5

				if limb.Name == "Head" then
					limb.CanCollide = true
					atch0 = char.Head.NeckRigAttachment
					atch1 = char.UpperTorso.NeckRigAttachment
				elseif limb.Name == "UpperTorso" then
					limb.CanCollide = true
					atch0 = char.UpperTorso.WaistRigAttachment
					atch1 = char.LowerTorso.WaistRigAttachment

					atch2 = char.UpperTorso.LeftShoulderRigAttachment
					atch3 = char.LeftUpperArm.LeftShoulderRigAttachment

					atch4 = char.UpperTorso.RightShoulderRigAttachment
					atch5 = char.RightUpperArm.RightShoulderRigAttachment
				elseif limb.Name == "LowerTorso" then
					limb.CanCollide = true
					atch0 = char.LowerTorso.LeftHipRigAttachment
					atch1 = char.LeftUpperLeg.LeftHipRigAttachment

					atch2 = char.LowerTorso.RightHipRigAttachment
					atch3 = char.RightUpperLeg.RightHipRigAttachment
				elseif limb.Name == "LeftUpperLeg" then
					limb.CanCollide = true

					atch0 = char.LeftUpperLeg.LeftKneeRigAttachment
					atch1 = char.LeftLowerLeg.LeftKneeRigAttachment
				elseif limb.Name == "RightUpperLeg" then
					limb.CanCollide = true

					atch0 = char.RightUpperLeg.RightKneeRigAttachment
					atch1 = char.RightLowerLeg.RightKneeRigAttachment
				elseif limb.Name == "LeftLowerLeg" then
					limb.CanCollide = true

					atch0 = char.LeftLowerLeg.LeftAnkleRigAttachment
					atch1 = char.LeftFoot.LeftAnkleRigAttachment
				elseif limb.Name == "RightLowerLeg" then
					limb.CanCollide = true

					atch0 = char.RightLowerLeg.RightAnkleRigAttachment
					atch1 = char.RightFoot.RightAnkleRigAttachment
				elseif limb.Name == "LeftUpperArm" then
					limb.CanCollide = true

					atch0 = char.LeftUpperArm.LeftElbowRigAttachment
					atch1 = char.LeftLowerArm.LeftElbowRigAttachment
				elseif limb.Name == "RightUpperArm" then
					limb.CanCollide = true

					atch0 = char.RightUpperArm.RightElbowRigAttachment
					atch1 = char.RightLowerArm.RightElbowRigAttachment
				elseif limb.Name == "LeftLowerArm" then
					limb.CanCollide = true

					atch0 = char.LeftLowerArm.LeftWristRigAttachment
					atch1 = char.LeftHand.LeftWristRigAttachment
				elseif limb.Name == "RightLowerArm" then
					limb.CanCollide = true

					atch0 = char.RightLowerArm.RightWristRigAttachment
					atch1 = char.RightHand.RightWristRigAttachment
				end

				if atch0 and atch1 then
					local ballInSocket = Instance.new("BallSocketConstraint", limb)
					ballInSocket.Attachment0 = atch0
					ballInSocket.Attachment1 = atch1
				end

				if atch2 and atch3 then
					local ballInSocket = Instance.new("BallSocketConstraint", limb)
					ballInSocket.Attachment0 = atch2
					ballInSocket.Attachment1 = atch3
				end

				if atch4 and atch5 then
					local ballInSocket = Instance.new("BallSocketConstraint", limb)
					ballInSocket.Attachment0 = atch4
					ballInSocket.Attachment1 = atch5
				end

			elseif limb:IsA("Accessory") then
				local h = limb:FindFirstChild("Handle")
				if h then
					local part0 = char.Head
					local atch = h:FindFirstChildOfClass("Attachment")

					if atch.Name == "HatAttachment" or atch.Name == "FaceFrontAttachment" then
						part0 = char.Head
					end

					local ap = Instance.new("AlignPosition", part0)
					if part0 == char.Head then
						ap.Attachment1 = char.Head:FindFirstChild(atch.Name)
						ap.Attachment0 = atch
						ap.RigidityEnabled = true
						ap.Responsiveness = 200
					end

					local ao = Instance.new("AlignOrientation", part0)
					if part0 == char.Head then
						ao.Attachment1 = char.Head:FindFirstChild(atch.Name)
						ao.Attachment0 = atch
						ao.RigidityEnabled = true
						ao.Responsiveness = 200
					end
				end
			end
		end
	end
		character:WaitForChild("Humanoid").Died:Connect(function()			
						ConnectLimbs(character)
end)
1 Like

Rightt and wouldn’t you initially think to show that? :joy:
Have you disabled BreakJointsOnDeath for the target character’s Humanoid?

It’s currently set to true, is it supposed to be false?

1 Like

Yes, for ragdoll scripts that do not automatically reattach broken joints, this is a necessity.
Who wouldn’t use it! Makes stuff a heck of a lot easier, your sword maybe has it’s own different ragdoll script or automatically disabled it.

I did that and the ragdoll isn’t being formed. It’s doing the same thing but with a walking animation.

1 Like

Do you have a custom animation handler?

No, it’s the default animation script provided by roblox.

1 Like