I currently am in the progress of making a ragdoll system.
The ragdoll seems fine at first, but then the body starts shaking too much.
These are 2 things that can happen when I press R.
This is my script on the client:
local UIS = game:GetService("UserInputService")
local Character = script.Parent
UIS.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.R then
game.ReplicatedStorage.Ragdoll:FireServer()
Character.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
Character.Humanoid.PlatformStand = true
end
end)
And this is my script on the server:
game.ReplicatedStorage.Ragdoll.OnServerEvent:Connect(function(Player)
local Character = Player.Character
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("Motor6D") and v.Name ~= "Neck" and v.Name ~= "LeftWrist" and v.Name ~= "RightWrist" then
Character.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
v.Enabled = false
local a1 = Instance.new("Attachment")
local a0 = Instance.new("Attachment")
a1.Parent = v.Part1
a0.Parent = v.Part0
a1.CFrame = v.C1
a0.CFrame = v.C0
local BallSocket = Instance.new("BallSocketConstraint")
BallSocket.Parent = v.Parent
BallSocket.LimitsEnabled = true
BallSocket.TwistLimitsEnabled = true
BallSocket.Attachment0 = a0
BallSocket.Attachment1 = a1
end
end
end)
Note: I just tried this with R6 rigs and it works perfectly, but I don’t really want to use R6 rigs for my game. So if anyone knows how to make ragdolls work with R15 rigs, that would be great.
I tried to look at your module and see what’s different between mine and yours and I added everything that changed something about a State or Constraint. After I did that, I still get the same result. Here’s my code now.
game.ReplicatedStorage.Ragdoll.OnServerEvent:Connect(function(Player)
local Character = Player.Character
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("Motor6D") and v.Name ~= "Neck" and v.Name ~= "LeftWrist" and v.Name ~= "RightWrist" then
Character.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
v.Enabled = false
local a1 = Instance.new("Attachment")
local a0 = Instance.new("Attachment")
a1.Parent = v.Part1
a0.Parent = v.Part0
a1.CFrame = v.C1
a0.CFrame = v.C0
local BallSocket = Instance.new("BallSocketConstraint")
BallSocket.Parent = v.Parent
BallSocket.LimitsEnabled = true
BallSocket.TwistLimitsEnabled = true
BallSocket.Attachment0 = a0
BallSocket.Attachment1 = a1
BallSocket.MaxFrictionTorque = 30
BallSocket.Restitution = 0.5
BallSocket.UpperAngle = 90
if v.Name == "Right Shoulder" or v.Name == "Left Shoulder" then
BallSocket.TwistUpperAngle = -30
end
end
end
end)
well i assume you cant rotate ur limbs 360 degrees irl, so maybe use hing constraints for the wrists and the lower arm, allowing for the wrist only able to go up and down, and the lower arm being able to “roll”. You can implement this by just checking the limb name or the motor6d name