As you can see in the video, when the character gets ragdolled, its position seems to snap / teleport.
Below, there is the code that makes the ragdoll. How can I make this smoother?
function module.Ragdoll(player, bool)
local Character = player.Character
local Humanoid = Character["Humanoid"]
local Motors = {Character.Torso["Left Hip"],
Character.Torso["Right Hip"],
Character.Torso["Left Shoulder"],
Character.Torso["Right Shoulder"],
Character.Torso["Neck"],
Character.PrimaryPart["Root Hip"]
}
if bool then
for _, obj in pairs(Motors) do
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = obj.C0
a1.CFrame = obj.C1
a0.Parent = obj.Part0
a1.Parent = obj.Part1
local BallSocket = Instance.new("BallSocketConstraint")
BallSocket.LimitsEnabled = true
BallSocket.TwistLimitsEnabled = true
if obj == Character.Torso["Neck"] then
BallSocket.TwistLimitsEnabled = true
end
BallSocket.Attachment0 = a0
BallSocket.Attachment1 = a1
BallSocket.Parent = obj.Part0
obj.Enabled = false
end
end
end
Edit: I figured out that if I disabled limits enabled and twistlimitsenabled it would work! But doesnt really have the same behavior. How would I accomplish this with a similar effect?
So this is a crazy like guess. I’m gonna throw this out here. Maybe you can make a module script, that contains a function that creates a new tween. Hear me out.
So in your code you see you’re setting CFrames right? Well what if you instead TWEEN them. Right? In theory that would work, I feel that’s where it’s snapping, whereas you can tween them and make it smoother?
Again this is completely unfounded and probably irrational but it’s an idea, let me know if it works and I might be able to help a bit!
I figured out that if I disabled limits enabled and twistlimitsenabled it would work! But doesnt really have the same behavior. How would I accomplish this with a similar effect?
No. The limbs basically dont have restrictions, as they had otherwise. I would like to have these restrictions without doing that kicking or whatever. If I cannot make this restriction, I guess I will just leave it like this.