Disable Player Collissions Script?

Instead of disabling collisions completely, I believe you are actually looking to assign them to a special collision group where parts cannot collide with themselves. Setting CanCollide itself would make the characters fall through the floor.

Firstly, create a collision group, either via a script or in the collision group editor. The code below should be quite self explainatory: the registration of a Players group if there isn’t one, and disabling collisions between members of the same group.

local PhysicsService = game:GetService("PhysicsService")
local PlayerService = game:GetService("Players")

if not PhysicsService:IsCollisionGroupRegistered("Players") then
	PhysicsService:RegisterCollisionGroup("Players")
end
PhysicsService:CollisionGroupSetCollidable("Players", "Players", false)

Each time a new character spawns, iterate through all parts and set their collision group.
Just like GetChildren(), GetDescedants() returns a flat array of descendants (which include children’s children, and further - all objects in the hierarchical tree). I thought GetDescendants() would also cover accessories, whose handles (BaseParts) are not immediate children of a character.

Because during the game parts might be added to the character, to cover those cases, a listener is connected to DescedantAdded, firing every time a new descendant becomes a member of the character.

-- the loop
for _,part in character:GetDescendants() do
	if part:IsA("BasePart") then
		part.CollisionGroup = "Players"
	end
end
-- the future descendants
character.DescendantAdded:Connect(function(descendant)
	if descendant:IsA("BasePart") then
		descendant.CollisionGroup = "Players"
	end
end)

About memory leaks:

The signal connections don’t disconnect themselves. They cease to be active once they are disconnected manually by calling :Disconnect(), or when the instance they are bound to is destroyed.

As evident from the announcement, character are not automatically destroyed by default, but they will become at some point this year.

Because the characters remain in the memory and because they are not properly destroyed, the above code leaks memory. The connection remains alive despite being unreachable and unused.

The simplest solution is to enable the new behaviour (workspace.PlayerCharacterDestroyBehavior).

image

An alternative involves either:

  • manual tracking/storing and disconnecting of the connection (maids or janitors are noticably helpful);
  • manual destroying of the whole old character after a new one is spawned.

Edit: grammar and phrasing.