Hello, members of devforum! I was making a ragdoll script, and everything works fine except one line of code. It doesn’t enable collision for meshparts inside character.
This is the whole script:
local value = Instance.new("BoolValue",script.Parent)
value.Name = "IsKnocked"
value.Value = false
value:GetPropertyChangedSignal("Value"):Connect(function(new)
print(value.Value)
local hum = script.Parent:FindFirstChild("Humanoid")
hum:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
hum.PlatformStand = true
for i,v in pairs(script.Parent:GetDescendants()) do
if v:IsA("Motor6D") then
--v.Part0.CanCollide = true
--v.Part1.CanCollide = true
local ball = Instance.new("BallSocketConstraint",v.Parent)
ball.TwistLimitsEnabled = false
ball.TwistLowerAngle = 30
ball.TwistUpperAngle = 30
ball.LimitsEnabled = true
ball.UpperAngle = 25
local att0 = v.Part0:FindFirstChild("RagAtt") or Instance.new("Attachment",v.Part0)
local att1 = v.Part1:FindFirstChild("RagAtt") or Instance.new("Attachment",v.Part1)
att0.CFrame = v.C0
att1.CFrame = v.C1
ball.Attachment0 = att0
ball.Attachment1 = att1
--ball.MaxFrictionTorque = 100
v.Enabled = false
elseif v:IsA("MeshPart") then
if not v:FindFirstAncestorWhichIsA("Accesory") then
v.CanCollide = true
print("collided up " .. v.Name)
end
end
end
end)
and this is the part of interest
elseif v:IsA("MeshPart") then
if not v:FindFirstAncestorWhichIsA("Accesory") then
v.CanCollide = true
print("collided up " .. v.Name)
end
end
It should turn on collision for every part of character but it doesn’t turn it on. Its not a local script, and is located in starterCharacter
this is the output, showing that it should enable it:
collided up Head - Server - Ragdoll:30
15:56:47.829 collided up LeftHand - Server - Ragdoll:30
15:56:47.830 collided up RightHand - Server - Ragdoll:30
15:56:47.830 collided up LeftLowerArm - Server - Ragdoll:30
15:56:47.830 collided up RightLowerArm - Server - Ragdoll:30
15:56:47.830 collided up LeftUpperArm - Server - Ragdoll:30
15:56:47.831 collided up RightUpperArm - Server - Ragdoll:30
15:56:47.831 collided up LeftFoot - Server - Ragdoll:30
15:56:47.831 collided up LeftLowerLeg - Server - Ragdoll:30
15:56:47.832 collided up UpperTorso - Server - Ragdoll:30
15:56:47.832 collided up LeftUpperLeg - Server - Ragdoll:30
15:56:47.832 collided up RightFoot - Server - Ragdoll:30
15:56:47.832 collided up RightLowerLeg - Server - Ragdoll:30
15:56:47.833 collided up LowerTorso - Server - Ragdoll:30
15:56:47.833 collided up RightUpperLeg - Server - Ragdoll:30
15:56:47.833 collided up Handle (x3)
my character basically just enables ragdoll, but parts without collision default(arms and legs) just go through baseplate.
btw, collision group is the issue, because i check the explorer and it shows that it’s collision is off.