I’m making a ragdoll system. Basically when you turn the bool value to true it ragdolls your character, but I have a problem with one script. When ragdolling, your character clips into the ground(Legs and arms), so I made a script which turns on the collision of them, but it doesn’t work for me, here’s the script:
if humanoid.Health ~= 0 then
for i,v in pairs(character:GetChildren()) do
if v:IsA("MeshPart") then
v.CanCollide = true
end
end
humanoid.Parent:FindFirstChild("Humanoid").PlatformStand = true
end
humanoid.Parent:FindFirstChild("HumanoidRootPart").CanCollide = false
humanoid.Died():Connect(function()
for _, v in pairs(character:GetChildren()) do
if v.Name ~= "HumanoidRootPart" then
v.CanCollide = true
end
end
humanoid.PlatformStand = true
end)
I don’t understand the sense of the script you provided, but here’s the much better version of and reformatted of it. I still don’t know what you’re trying to accomplish with PlatformStand.
You can try this as sometimes limbs may not be a mesh part:
if humanoid.Health > 0 then
for i,v in pairs(character:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide = true
end
end
humanoid.PlatformStand = true
end
humanoid.Parent:WaitForChild("HumanoidRootPart").CanCollide = false
This is kinda useless, why find the humanoid when you already have it?