Hi I’m trying to make a Player Ragdoll if they touch a ClickDetector and it didn’t go well for me. Basically the body won’t fall and just stays and I still haven’t gotten any better solutions to fix this.
This is what the bug looks like:
This is the Script I use:
for index,joint in pairs(Character: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:Destroy()
end
end
try changing the humanoid state to ragdoll and disabling getting up:
(i just realised that i wrote the code completely wrong here)
for index,joint in pairs(Character: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:Destroy()
end
end
for _, Character in pairs(Ragdoll:GetDescendants()) do
if Limb:IsA("BasePart") then
Limb:SetNetworkOwner(nil)
end
end
Ragdoll.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
Ragdoll.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
Try adding ragdoll forces through the client. If this doesn’t work, set the humanoid state type to Enum.HumanoidStateType.Physics.
Also – this is extremely important – make sure to END ALL CURRENT ANIMATIONS on the ragdolled player. You can do this by running the following code on the ragdolled player’s client before you start the ragdoll:
for _, v in Humanoid.Animator:GetPlayingAnimationTracks() do
v:Stop()
end
-- then enable the ragdolling
Doing all three of these things should fix your issue. It fixed mine.
local Character = workspace.Rig
local Hum = Character:FindFirstChildOfClass("Humanoid")
Hum.RootPart:Destroy()
Hum:ChangeState(Enum.HumanoidStateType.PlatformStanding)
for index,joint in pairs(Character: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:Destroy()
end
end
for _,v in pairs(Character:GetChildren()) do
if v:IsA("BasePart") then
local clone = Instance.new("Part",v)
clone.Name = "hit"
clone.Transparency = 1
clone.CFrame = v.CFrame
clone.Size = v.Size/1.5
local weld = Instance.new("Weld",clone)
weld.Part0 = v
weld.Part1 = clone
weld.Name = "Join"
end
end