Ways to make this force with ragdoll smoother % ragdoll bugs

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    im attempting to make my own Slap Battles game while having the game feel as smooth as possible
  2. What is the issue? Include screenshots / videos if possible!
    theres 2 main ones shown in the video below:
    ( 1. the torso begins moving before the other limbs, making it feel chunky.)
    ( 2. the ragdoll seems to sort of explode when launching it with high power. [shown at 0:42] )
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

–ragdoll issue
ive tried turning off the colliders on them, unwelding the torso from hrp causes more issues with it exploding (will remove if possible)

–force issue
(NOTE THAT I THINK BOTH OF THEM ARE CAUSED FROM THE RAGDOLL, FORCE MENTIONED TO BE SAFE)
ive tried turning the bodyvelocity debris high and lower lifetime

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

(the ragdoll function)

module.Ragdoll = function(character, length)
	if  character:FindFirstChild("Ragdolled") then
		module.Unragdoll(character)
		task.wait(0.004)
	end
	local ragdolled = Instance.new("Folder", character)
	ragdolled.Name = "Ragdolled"
	local key = math.random(1,99999999) * math.random(1,5) / math.random(2,9)
	local HolderKey = Instance.new("NumberValue",ragdolled)
	HolderKey.Name = "Key"
	HolderKey.Value = key
	character.Humanoid.PlatformStand = true
	character.Humanoid.RequiresNeck = false
	character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Ragdoll,true)
	character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.FallingDown,true)
	character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
	character:FindFirstChildOfClass("Humanoid").Jump = false
	for _, v in character:GetDescendants() :: {Instance} do
		if v:IsA("Motor6D") and v.Name ~= "Glove"  and v.Parent.Name ~= "HumanoidRootPart" then
			local bsc = Instance.new("BallSocketConstraint", v.Parent)
			bsc.LimitsEnabled = true
			bsc.TwistLimitsEnabled = true
			local collider = Instance.new("Part",bsc)
			collider.Position = v.Part1.Position
			collider.Size = v.Part1.Size * Vector3.new(1,0.75,1)
			collider.Transparency = 1
			collider.Massless = true
			collider.CanCollide = true
			local density = 0.0001
			local elasticity = 0
			local elasticityWeight = 0
			local friction = 0
			local frictionWeight = 0
			collider.CustomPhysicalProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)

			local weld = Instance.new("Weld",collider)
			weld.Part0 = v.Part1
			weld.Part1 = collider
			weld.C0 = CFrame.new(0,-v.Part1.Size.Y/6,0)
			local a0 = Instance.new("Attachment", v.Part0)
			local a1 = Instance.new("Attachment", v.Part1)
			bsc.Name = (v.Name.."rag")
			a0.CFrame = v.C0
			a1.CFrame = v.C1
			bsc.Attachment0 = a0
			bsc.Attachment1 = a1
			v.Enabled = false
		elseif v.Parent.Name == "HumanoidRootPart" and v:IsA("Motor6D") then
			local weld = Instance.new("Weld",v.Parent)
			weld.Part0 = v.Parent.Parent.HumanoidRootPart
			weld.Part1 = v.Parent.Parent.Torso
			weld.Name = "attache"
		
		end
	end
	for i,v in pairs(character:GetChildren()) do
		if v:IsA("BasePart") then
			v.CollisionGroup = "Ragdolled"
		end
	end

	character.Humanoid.AutoRotate = false
	character.Humanoid.PlatformStand = true


	local yes = character.PastJP.Value
	character.Humanoid.JumpPower = 0
	character.Humanoid.WalkSpeed = 0
	character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Ragdoll,false)
	character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.FallingDown,false)
	character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.GettingUp,true)
	if game.Players:GetPlayerFromCharacter(character) then
		game.ReplicatedStorage.Remotes.CameraObject:FireClient(game.Players:GetPlayerFromCharacter(character),character.Head)
	end


	task.spawn(function()
		if length ~= 0 or not length and length then
			if length > 999 then
				return
			end
			task.wait(length)
			module.Unragdoll(character,key)
		end
	end)
end

(the force giver)

		local lifetime = 0.1
		local Velocity=(direction*power)*5 / 3
		local bav = Instance.new("BodyAngularVelocity",Target:FindFirstChild("HumanoidRootPart"))
		bav.AngularVelocity = Velocity+Vector3.new(-power/10,1*power/30,0)
		bav.MaxTorque = Vector3.new(1e8,1e8,1e8)
		local velocity = Instance.new("BodyVelocity", Target:FindFirstChild("HumanoidRootPart"))
		velocity.Velocity = (direction * power ) + Vector3.new(0,math.abs(power) / 1.2,0) 
		velocity.MaxForce = Vector3.new(1e8,1e8,1e8) 
		game.Debris:AddItem(velocity,lifetime)
		game.Debris:AddItem(bav,lifetime)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

dont be afraid of asking questions, and any tips (related or not) are appreciated!

1 Like

I would set the NetworkOwner to the person slapping, and then adding the Velocity using the Client.

  • Since your already firing RemoteEvents, you should know how to Fire RemoteEvent to the Client after setting the NetworkOwner, with that you will achieve a way better end result.
1 Like

Wouldnt that cause issues with exploits being able to control who they slap
(note that i think both of the issues are caused by the ragdoll)

1 Like

Roblox barely has exploiters anymore, the only exploiters are using Mobile/ Windows Store[aka XBOX] version of the game, since it doesn’t have byfron.

1 Like

rare or not its better safe then sorry as im trying to not make my playerbase angry with an easily exploitable game

1 Like

You could also use task.spawn(function() for multiple for _,v loops
currently each for _,v loop is taking some time of the script,

1 Like

that makes it slightly better, but the exploding ragdoll still happens

1 Like

I also would make the Ragdoll before the Velocity.

1 Like

no different results happen
(30 limit)

1 Like

To me it looks very laggy, since it feels like the Server is doing every calculation rn,
Have you tried checking out what it looks like using Clients?

1 Like

Second option would be calculating everything from that,

1 Like

well, i fixed BOTH issues by using a ragdoll from an older project.
whats strange though is that their the exact same except for different variable names, thank you for the help though!

2 Likes