How to make ragdoll similar like that?
Um…
You can just replace a rig’s Motor6Ds with Physical Constraints, more precisely BallSocketConstraints
…
1 Like
typically, Ragdoll systems are made by creating an invisible part inside of every single body part of every players character and linking all body parts together with a Ball-Socket Constraint instead of a Motor6D when in the Ragdoll state (you can use Attributes for this), again, this is a bit more of a tricky creation but this video helped me out with understanding and even making my own Ragdoll system which I use in my current project.
Okay, I made scripts, but I have a bit problem
robloxapp-20241111-1520313.wmv (1.5 MB)
Here is ModuleScript
local ragdoll = {}
function ragdoll.Start(character)
if character.Ragdoll.Value then return end
character.Ragdoll.Value = true
for i, joint in pairs(character:GetDescendants()) do
if joint:IsA("Motor6D") then
local socket = Instance.new("BallSocketConstraint")
local a0 = Instance.new("Attachment")
local a1 = Instance.new("Attachment")
a0.Parent = joint.Part0
a1.Parent = joint.Part1
socket.Parent = joint.Parent
socket.Attachment0 = a0
socket.Attachment1 = a1
a0.CFrame = joint.C0
a1.CFrame = joint.C1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
joint.Enabled = false
end
end
character.Humanoid.WalkSpeed = 0
character.Humanoid.JumpPower = 0
character.Humanoid.PlatformStand = true
character.Humanoid.AutoRotate = false
end
function ragdoll.Stop(character)
local hrp = character:FindFirstChild("HumanoidRootPart")
local hum = character:FindFirstChild("Humanoid")
hum.PlatformStand = false
for i, joint in pairs(character:GetDescendants()) do
if joint:IsA("BallSocketConstraint") then
joint:Destroy()
end
if joint:IsA("Motor6D") then
joint.Enabled = true
end
end
character.Ragdoll.Value = false
hum:ChangeState(Enum.HumanoidStateType.GettingUp)
hum.WalkSpeed = 16
hum.JumpPower = 50
hum.AutoRotate = true
end
return ragdoll
and script for tool
local tool = script.Parent
local debounce = true
tool.Activated:Connect(function()
if debounce == true then
debounce = false
wait(tool.Cooldown.Value)
debounce = true
end
end)
tool.Handle.Touched:Connect(function(hit) -- Ragdoll
if debounce == false then
script.Disabled = true
local Ragdoll = require(game.ServerScriptService.Main.Ragdoll)
Ragdoll.Start(hit.Parent)
local force = Instance.new("BodyVelocity", hit.Parent.HumanoidRootPart)
force.MaxForce = Vector3.new(2,2,2) * math.huge
local direction = (hit.Parent.HumanoidRootPart.CFrame.Position - tool.Parent.HumanoidRootPart.CFrame.Position).Unit
force.Velocity = (direction + Vector3.new(0,1,0)).Unit * 25
local rotation = Instance.new("BodyAngularVelocity", hit.Parent.HumanoidRootPart)
rotation.AngularVelocity = Vector3.new(1,1,1) * math.pi * 5
rotation.MaxTorque = Vector3.new(2,2,2) * math.huge
rotation.P = 5000
tool.Handle.Slap:Play()
wait(0.35)
force:Destroy()
rotation:Destroy()
script.Disabled = false
wait(math.random(1.25, 3.15))
Ragdoll.Stop(hit.Parent)
end
end)