You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want my ragdoll system to ragdoll the player when called, wait for the specified duration, and get back up. - What is the issue? Include screenshots / videos if possible!
They don’t unragdoll, and look weird, similar to how https://devforum.roblox.com/t/my-ragdollin-system-isnt-working/2899586’s issue was. - What solutions have you tried so far? Did you look for solutions on the Creator Hub?
ai and yes i did
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!
local module = {}
local Players = game:GetService("Players")
local active = {}
local attachments = {
["Neck"] = {
CFrame.new(0,1,0,-1,0,0,0,0,1,0,1,0),
CFrame.new(0,-0.5,0,-1,0,0,0,0,1,0,1,0)
},
["Left Shoulder"] = {
CFrame.new(-1.3,0.75,0),
CFrame.new(0.2,0.75,0)
},
["Right Shoulder"] = {
CFrame.new(1.3,0.75,0),
CFrame.new(-0.2,0.75,0)
},
["Left Hip"] = {
CFrame.new(-0.5,-1,0),
CFrame.new(0,1,0)
},
["Right Hip"] = {
CFrame.new(0.5,-1,0),
CFrame.new(0,1,0)
},
}
local function makeConstraints(char)
local data = {
motors = {},
constraints = {}
}
for _,motor in ipairs(char:GetDescendants()) do
if motor:IsA("Motor6D") then
data.motors[motor] = motor.Enabled
local info = attachments[motor.Name]
if info then
local a0 = Instance.new("Attachment")
a0.Name = "RagdollAttachment"
a0.CFrame = info[1]
a0.Parent = motor.Part0
local a1 = Instance.new("Attachment")
a1.Name = "RagdollAttachment"
a1.CFrame = info[2]
a1.Parent = motor.Part1
local socket = Instance.new("BallSocketConstraint")
socket.Name = "RagdollConstraint"
socket.Attachment0 = a0
socket.Attachment1 = a1
socket.LimitsEnabled = true
socket.UpperAngle = 90
socket.Parent = motor.Part0
table.insert(data.constraints,socket)
end
motor.Enabled = false
end
end
active[char] = data
end
local function clear(char)
local data = active[char]
if not data then
print("[Ragdoll] NO DATA")
return
end
for _,v in ipairs(data.constraints) do
if v then
v:Destroy()
end
end
for motor,state in pairs(data.motors) do
if motor and motor.Parent then
motor.Enabled = state
end
end
active[char] = nil
end
function module:Unragdoll(char)
print("[Ragdoll] OFF")
local hum = char:FindFirstChildOfClass("Humanoid")
if not hum then return end
clear(char)
hum.AutoRotate = true
hum.PlatformStand = false
task.wait()
hum:ChangeState(Enum.HumanoidStateType.GettingUp)
print("[Ragdoll] RESTORED")
end
function module:Ragdoll(char,time)
print("[Ragdoll] ON")
local hum = char:FindFirstChildOfClass("Humanoid")
if not hum then
print("[Ragdoll] NO HUMANOID")
return
end
makeConstraints(char)
hum.AutoRotate = false
hum:ChangeState(Enum.HumanoidStateType.Physics)
print("[Ragdoll] ACTIVE")
if time then
task.spawn(function()
print("[Ragdoll] TIMER",time)
task.wait(time)
print("[Ragdoll] TIMER END")
if char.Parent then
module:Unragdoll(char)
end
end)
end
end
return module
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.
My scripting is a lot of the times a hot mess
If anyone can find something that would be easy to use and not a bad ragdoll module, please do let me know about it