How could i fix my ragdolls lagging

my ragdolls are lagging, i’ve tried making the humanoidrootpart massless, this does work however this makes the ragdoll have slippery movement and slow shiftlock as shown in this video: Watch Desktop 2024.10.20 - 19.55.18.16 | Streamable

its an active ragdoll btw if this helps

4 Likes

Just looks like server to client lag to me.

I need some more information to be able to help you better.
What exactly are you doing to make that character? Is it a Script? Is it clientside?


Best regards,
Pinker

1 Like

thanks for replying
it is a serverside script

1 Like

Okay, can you try setting the RunContext of the script to Client?


Best regards,
Pinker

i set the runcontext to client and now whenever i try to set the hrp.massless to true it just freezes the entire character in 1 place

What?

Can you make another video on that?
Also, what happens if the HumanoidRootPart isn’t massless? Does it just do the same thing as before?

You also didin’t answer what you’re doing to make the character. I can’t really help you without that.


Best regards,
Pinker

here’s the video of the character freezing: Watch Desktop 2024.10.20 - 20.46.48.18 | Streamable
and for the character, i’m using a regular r6 rig

That’s not what i meant. What is the code that you’re using to make/move the rig which is having the problem?


PS: If this turns out to be some Roblox physics problem, I’m not qualified to help.


Best regards,
Pinker

i do not use any code to move the rig, i only have an alignorientation that rotates the limbs according to the current animation playing

I’m even more confused now. What script did you set to clientside then?


Anyways, problem is most likely AlignOrientation.RigidityEnabled being off.


Best regards,
Pinker

i’ve set the alignorientation rigidityenabled to true, however the ragdoll is still lagging: Watch Desktop 2024.10.20 - 21.04.17.20 | Streamable

the script i set to clientside was the one that makes the active ragdoll work

Okay, show me the script. I can’t help you without anything to work with.


Best regards,
Pinker

	local rag = char:WaitForChild("IsRagdoll")
	local root = char:WaitForChild("HumanoidRootPart")

	local clonedCharacter = nil

	task.wait(1)
	print("active ragdoll on " .. char.Name .. " activated")
	--root.RootJoint.Enabled = false
	--root.TEMPORARY_ROOTJOINT.Enabled = true
	--root.Massless = true
	--root.rootjoint_unused.Enabled = false
	--root.RootJoint.Enabled = true

	clonedCharacter = Instance.new("Model")
	clonedCharacter.Parent = char

	local clonedLimbs = {}
	for _, v in pairs(char:GetChildren()) do
		if v:IsA("BasePart") then
			v.CollisionGroup = "char"

			local newLimb = Instance.new('Part')
			newLimb.Size = v.Size
			newLimb.CanCollide = false
			newLimb.CanQuery = false
			newLimb.CanTouch = false
			newLimb.Massless = true
			newLimb.Anchored = false
			newLimb.Name = v.Name
			newLimb.Transparency = 1
			newLimb.Parent = clonedCharacter
			newLimb.Color = Color3.fromRGB(math.random(1, 255),math.random(1, 255), math.random(1, 255))

			table.insert(clonedLimbs, v)
		end
	end

	for _, v in pairs(clonedCharacter:GetChildren()) do
		if v:IsA("BasePart") and v.Name ~= "Torso" then
			if v.Name == "HumanoidRootPart" then
				local newJoint = Instance.new("Motor6D")
				newJoint.Enabled = true
				newJoint.Part1 = clonedCharacter.Torso
				newJoint.Part0 = v
				newJoint.Name = "RootJoint"
				newJoint.C0 = root.RootJoint.C0
				newJoint.C1 = root.RootJoint.C1
				newJoint.Parent = v

				local newjoint2 = newJoint:Clone()
				newjoint2.Part1 = root
				newjoint2.Part0 = v
				newjoint2.Name = "connectir"
				newjoint2.Parent = root
			else
				local newJoint = Instance.new("Motor6D")
				newJoint.Enabled = true
				newJoint.Part1 = v
				newJoint.Part0 = clonedCharacter.Torso
				newJoint.Name = motor6ds[v.Name]

				newJoint.C0 = char.Torso[motor6ds[v.Name]].C0
				newJoint.C1 = char.Torso[motor6ds[v.Name]].C1
				newJoint.MaxVelocity = char.Torso[motor6ds[v.Name]].MaxVelocity

				newJoint.Parent = clonedCharacter.Torso

				--print(newJoint.Part0.Parent)
				--print(newJoint.Part1.Parent)
			end
		end
	end

	for i, v in pairs(clonedLimbs) do
		if v:IsA("BasePart") then
			--print(v)
			local clonedLimb = clonedCharacter:FindFirstChild(v.Name)
			if not clonedLimb then
				table.remove(clonedLimbs, i)
				continue
			end

			local attachment = Instance.new('Attachment', v)
			local clonedAttachment = Instance.new('Attachment', clonedLimb)

			local orientation = Instance.new('AlignOrientation')
			orientation.Name = v.Name
			orientation.CFrame = clonedLimb.CFrame
			orientation.Attachment0 = attachment
			orientation.Attachment1 = clonedAttachment
			orientation.ReactionTorqueEnabled = true
			orientation.RigidityEnabled = true
			orientation.MaxTorque = 3000
			orientation.Responsiveness = 200
			orientation.Parent = v
		end
	end

	runService.Stepped:Connect(function()
		for _, v in pairs(char:GetChildren()) do
			if v:IsA("BasePart") and v.Name ~= "Torso" and v.Name ~= "HumanoidRootPart" then
				local clone_limb = clonedCharacter:FindFirstChild(v.Name)
				local ao = v:FindFirstChildWhichIsA("AlignOrientation")
				ao.CFrame = clone_limb.CFrame
			end
		end
		for _, v in pairs(clonedCharacter:GetChildren()) do
			if v:IsA("BasePart") then
				v.CanCollide = false
				v.Massless = true
			end
		end
	end)

	rag.Value = true

If this is a script where you ragdoll completely then there are way better ways with the help of ball socket constraints.

1 Like

Why are you using AlignOrientation anyway? I haven’t seen any other ragdoll scripts use it.
They usually only use BallSocketConstraints. So what are you using them for?

I’m not sure I understand what you’re doing there, but I think you’re cloning the character and then aligning the clone to the actual character so the clone is animated or the other way around.

I don’t even understand why you have to have a clone in the first place tbh. Seems to me that if you get rid of it, it would fix the issue.


Best regards,
Pinker

it is an active ragdoll that i am making and there’s no other way around to make it animated other than use springconstraints or alignorientation (which is the best option), the problem is that the ragdoll lags on the server and from other client’s perspectives

Is this ragdoll for when you die or upon an input?

neither, the ragdoll is always there and enabled

Can you explain why the clone is neccessary exactly? Maybe we can find a way to make it not.


I’ve seen stuff like this happen in games I played, and it wasn’t really a big deal.

Also this is 100% server lag, which the clone seems to be the root cause of. If it was only there when you ragdoll, maybe it would be better.

You could actually do this really easily by having the ragdoll transparent until you want it to be active. Then you make the player transparent.

Is this a viable solution? If not, why?


Best regards,
Pinker

doubt that the clone is the root cause of it, without the clone the active ragdoll code wouldn’t work, and yes the clone is necessary. the ragdoll is definitely the root cause of it, however as i said if i try to remedy the ragdoll lag by setting the humanoidrootpart massless to true, there are side effects such as the player having slippery movement and slow shiftlock: Watch Desktop 2024.10.20 - 19.55.18.16 | Streamable