As the title states, this is what I mean to achieve. There’s also a problem with when the ragdoll is temporary, as the arms just clip through the ground. Here is the footage without the collision parts I scripted:
https://gyazo.com/9bc71508ca8d13ff47dfdad09846e58f
It either gives this result or similar ones. Yet here is the footage when my collision parts are added:
https://gyazo.com/686a8c0036fc4a3a8d2ed3cf6601dd16
Here is the code:
for _,v in pairs(character:GetDescendants()) do
if v:IsA("Motor6D") then
local a1 = Instance.new("Attachment", v.Part0)
local a2 = Instance.new("Attachment", v.Part1)
a1.CFrame = v.C0
a2.CFrame = v.C1
local socket = Instance.new("BallSocketConstraint", v.Parent)
socket.Attachment0 = a1
socket.Attachment1 = a2
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
humanoid.PlatformStand = true
v.Enabled = false
end
end
for _,v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
local collide = Instance.new("Part", v)
collide.Name = "Collision"
collide.Anchored = false
collide.CanCollide = true
collide.Transparency = 1
collide.CFrame = v.CFrame
local weld = Instance.new("Motor6D", collide)
weld.Part0 = v
weld.Part1 = collide
character.Torso.Touched:Connect(function(hit)
if hit ~= v and v:FindFirstChild("BallSocketConstraint") then
if v.Velocity.Magnitude > 2 then
if debounce then return end debounce = true
local sound = Instance.new("Sound", character.Torso)
sound.SoundId = "rbxassetid://"..impacts[math.random(1, #impacts)]
sound:Play()
game.Debris:AddItem(sound, sound.TimeLength)
wait(sound.TimeLength)
debounce = false
end
end
end)
end
end
Please do note that the ragdoll works fine (when I remove the collision parts of course) on death, yet it clips when temporary. Hence why I want collisions, to prevent clipping during temporary ragdoll and for more realism.