Ragdolls not working for some reason

Insert text here.

  1. What do you want to achieve? Keep it simple and clear!

I have a gun system that includes a bullet hole system. When you shoot a humanoid’s limbs, it simply creates a gunshot wound where it hit.

I want there to be a sort of bleeding from the wound, which I want to achieve through a blood decal spawning and expanding where the bullet hole was created.

  1. What is the issue? Include screenshots / videos if possible!

The problem here is that while the bloodsplatter (which accompanies the gunshot wound* expands, the ragdoll freezes (primarily when the fatal shot was on the torso)

Here is a video of the issue, pause if you need to read:

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have only yet tried using a while function. While it partially works, it causes some horrible frame drops.

Here are the designated lines of code:

if raycast then
		hitpos = raycast.Position
		local debugpart = Instance.new("Part", workspace)
		debugpart.Position = raycast.Position
		debugpart.Size = Vector3.new(0.5, 0.5, 0.5)
		debugpart.Material = Enum.Material.Neon
		debugpart.Color = Color3.new(1, 0, 0.0156863)
		debugpart.Anchored = true
		debugpart.Transparency = 1
		debugpart.CanCollide = false
		debugpart.CanQuery = false
		debugpart.Name = "Flesh"
		debris:AddItem(debugpart, 4)
		local falloffdam = statfolder.BaseDmg.Value - raycast.Distance / 3
		local hum = raycast.Instance.Parent:FindFirstChild("Humanoid")
		if hum then
			local particlepuffclone = game.ReplicatedStorage.WeaponAssets.Particles.Blood.Puff:Clone()
			local particlesplashclone = game.ReplicatedStorage.WeaponAssets.Particles.Blood.HorizontalSplat:Clone()
			local particlecircleclone = game.ReplicatedStorage.WeaponAssets.Particles.Blood.BloodCircle:Clone()
			particlepuffclone.Parent = debugpart
			particlesplashclone.Parent = debugpart
			particlecircleclone.Parent = debugpart
			particlepuffclone:Emit(math.random(8, 19))
			particlesplashclone:Emit(math.random(8, 19))
			particlecircleclone:Emit(math.random(8, 19))
			local hitsounds = game.ReplicatedStorage.WeaponAssets.HitSounds.Flesh.Hit:GetChildren()
			local hitsoundsfatal = game.ReplicatedStorage.WeaponAssets.HitSounds.Flesh.Fatal:GetChildren()
			local soundclonenon = hitsounds[math.random(1, #hitsoundsfatal)]:Clone()
			soundclonenon.Parent = debugpart
			soundclonenon:Play()
			local bullethole = game.ReplicatedStorage.WeaponAssets.BulletHoles.Flesh:Clone()
			bullethole.Parent = raycast.Instance.Parent
			bullethole.Attachment.Position = Vector3.new(0,0,0)
			bullethole.Position = raycast.Position
			bullethole.CFrame = CFrame.new(bullethole.Position, bullethole.Position + raycast.Normal)
			local fleshbloodfolder = game.ReplicatedStorage.WeaponAssets.BulletHoles.FleshBlood:GetChildren()
			local fleshblood = fleshbloodfolder[math.random(1, #fleshbloodfolder)]:Clone()
			fleshblood.Parent = bullethole
			fleshblood.CFrame = bullethole.CFrame
			local bloodweld = Instance.new("WeldConstraint", raycast.Instance)
			bloodweld.Part0 = bullethole
			bloodweld.Part1 = fleshblood
			local bulletweld = Instance.new("WeldConstraint", raycast.Instance)
			bulletweld.Part0 = raycast.Instance
			bulletweld.Part1 = bullethole
			bullethole:SetNetworkOwner(nil)
			fleshblood:SetNetworkOwner(nil)
			if raycast.Instance.Name == "Torso" then
				hum:TakeDamage(falloffdam * 1.5)
				if hum.Health < 1 then
					local soundclone = hitsoundsfatal[math.random(1, #hitsoundsfatal)]:Clone()
					soundclone.Parent = debugpart
					soundclone:Play()
				end
			elseif raycast.Instance.Name == "Head" then
				hum:TakeDamage(falloffdam * 10)
				if hum.Health < 1 then
					local soundclone = hitsoundsfatal[math.random(1, #hitsoundsfatal)]:Clone()
					soundclone.Parent = debugpart
					soundclone:Play()
				end
			elseif raycast.Instance.Name == "Left Arm" or raycast.Instance.Name == "Right Arm" or raycast.Instance.Name == "Left Leg" or raycast.Instance.Name == "Right Leg" then
				hum:TakeDamage(falloffdam)
				if hum.Health < 1 then
					local soundclone = hitsoundsfatal[math.random(1, #hitsoundsfatal)]:Clone()
					soundclone.Parent = debugpart
					soundclone:Play()
				end
			end
			local bloodexpand = tweenservice:Create(fleshblood, bloodtween, {Size = Vector3.new(math.random(7, 9)/ 10, math.random(7, 9)/ 10, 0.01)})
			bloodexpand:Play()
			bloodexpand.Completed:Connect(function()
				bloodexpand:Destroy()
			end)
			bullethole.Attachment.BulletHoleBleeding.Enabled = false
		end
	end

If I do eventually find a solution, I will let everyone know.

Have you made sure that all parts being put onto the player (fleshblood,bullethole,etc) are not anchored and can collide is off?

Uh, uh. The assets themselves have their cantouch, cancollide, and canquery off. The parts are also being put on the player, but are being parented to the character, not the limb itself, is that an issue?

It shouldn’t be. But since your welding those parts. Make sure their not anchored.

I checked ingame and the parts are not anchored. A weird thing to note is that this doesn’t occur on the serverside part of things, only on the clients.

Could you try setting the network ownership of the ragdolls to the server? Maybe it is to do with that. You also might want to look at the network diagnostics view in Roblox Studio. It might give you a hint at whats happening. Are you tweening the splats on the server side or the client? idk but this might have something to do with it. Also, does it affect other players? Just some thoughts. I hope they help. I also was having some trouble with a ragdoll system recently.

The splats are being tweened on the server, but I will take your advice and look at the network diagnostics. Also, the script set’s the humanoidrootpart’s network ownership to nil (or the server, I assume). Should I try that for every limb?

Maybe. I don’t really know though because I was having trouble myself with a ragdolls and even setting it for every limb did not work out. I ended up having to scrap mine (for now at least) because the network ownership just would not stay with the server but I hope you can find a fix for yours.

On that note: I also scrapped my ragdoll system for a saw-esque game. I will drop this one for now.

I have fixed the issue. apparently it wasn’t the for* loop that was causing lag spikes. it was the abundance of exported animations i had in the workspace. anyways, the issue is fixed now (using the for loop). thx to everyone who attempted to help fix this issue.

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