While developing my game, I wanted to add something where if you hit a fall too fast, or if you fall from a large height with enough momentum, you will take damage and ragdoll. Everything works except that the player is still in control when in ragdoll.
When I change the humanoid state type, nothing happens. I was wondering if there’s anything I am doing wrong or anything n the code that is causing this error?
char.Humanoid.RequiresNeck = false -- this is so the char wont die when ragdoll applied
char.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
local d = char:GetDescendants()
for index, joint in pairs(script.Parent:GetDescendants()) do
if joint:IsA('Motor6D') then
local socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Parent = joint.Part0
a2.Parent = joint.Part1
socket.Parent = joint.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
a1.CFrame = joint.C0
a2.CFrame = joint.C1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
joint.Enabled = false
end
end
The limbs are limp, but I want the character to not have control of their body, like an actual ragdoll.
Thank you!