CanCollide property assignment returns no error, but does not function either

I am making a ragdoll script and part of it is leaving the character’s dead body behind for a minute.
Everything works as intended except for one thing; Some of the player’s body parts have CanCollide disabled.

This is the part of the code that is important.

			local dBody = char:Clone()
			dBody.Parent = game.Workspace.DeadCharParts
			
			for i, v in pairs(dBody:GetDescendants()) do
				if v:IsA("BasePart") then
					v.Anchored = true
					v.CanCollide = false
				else if v:IsA("BillboardGui") then
						v:Destroy()
					end
				end
			end
			
			dBody:FindFirstChildWhichIsA("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
			dBody:FindFirstChildWhichIsA("Humanoid").HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
			
			game.Debris:AddItem(dBody, 60)

Any advice?

1 Like