As you can see in this image, the ragdoll has it’s limbs set to CanCollide true, but somehow there’s just no collision.
It’s not a studio gui problem, because printing CanCollide property says it’s true.
I haven’t done anything with collision groups. I’ve only changed the CanCollide property.
The collision on the limbs seems to be behaving strange, the collision gets set and it works fine, but then the limbs fall into the floor every 10-20 seconds, lasting about 1-5 seconds.
The humanoid state isn’t even being changed. Is there some other strange humanoid behavior I should know about?
Well then that’s the problem. It’s been this way since 2016.
I’ve found @POOPENGUIN solution works which does it by reparenting the character children on death.
However you need an additional basepart check since now in 2022 WrapTarget is added which is named head as well and errors.
server script w/ small update
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
print("Ragdoll added")
Char:WaitForChild("Humanoid").BreakJointsOnDeath = false
Char.Humanoid.Died:Connect(function()
local charModelClone = Instance.new("Model")
charModelClone.Parent = game.Workspace
local charChildren = Char:GetChildren()
Char.HumanoidRootPart.CanCollide = false
for i = 1,#charChildren do
charChildren[i].Parent = charModelClone
end
for _, v in pairs(charModelClone:GetDescendants()) do
if v:IsA("BasePart") then
v:SetNetworkOwner(Player)
if v.Name == "Head" then
v.CanCollide = true
end
end
if v:IsA("Motor6D") then
local Att0, Att1 = Instance.new("Attachment"), Instance.new("Attachment")
Att0.CFrame = v.C0
Att1.CFrame = v.C1
Att0.Parent = v.Part0
Att1.Parent = v.Part1
local BSC = Instance.new("BallSocketConstraint")
BSC.Attachment0 = Att0
BSC.Attachment1 = Att1
BSC.Parent = v.Part0
if v.Part1.Name == "Head" then
BSC.LimitsEnabled = true
BSC.TwistLimitsEnabled = true
end
v.Enabled = false
end
if v.Name == "AccessoryWeld" then
local WC = Instance.new("WeldConstraint")
WC.Part0 = v.Part0
WC.Part1 = v.Part1
WC.Parent = v.Parent
v.Enabled = false
end
end
end)
end)
end)
Actually not sure, seems like the state for @POOPENGUIN solution is also in a dead state, seems like it’s something odd with your specific ragdoll script since you haven’t shown yours specifically.
Perhaps it’s a network owner problem, are you changing CanCollide on server or client?
Well I fixed it by reparenting the character’s arms and legs to a separate model outside of the character (so the ragdoll consists of two separate models). This frees the limbs from the influence of the humanoid.
Then I just made sure the welds were working correctly, and that the separate ragdoll model gets destroyed whenever the character gets destroyed.
Doing this works for the custom characters in my game, but problems may arise for roblox avatars.