How do I disable collisions for everything that has a humanoid?

I need to disable collisions for not only players, but all entities in the game (so they don’t collide with eachother). How can I do this?

1 Like

Collisions group might be the one you’re gonna look for.

1 Like

I believe there are multiple resources and posts about this topic already–please search before posting.

Like @ItzMeZues_IGotHacked said, collisions group is a good way to go.

1 Like

I got a better one, it’s a script I found in the toolbox but I changed it up a bit

local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
 
local playerCollisionGroupName = "Players"
PhysicsService:CreateCollisionGroup(playerCollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(playerCollisionGroupName, playerCollisionGroupName, false)
 
local previousCollisionGroups = {}
 
local function setCollisionGroup(object)
  if object:IsA("BasePart") then
    previousCollisionGroups[object] = object.CollisionGroupId
    PhysicsService:SetPartCollisionGroup(object, playerCollisionGroupName)
  end
end
 
local function setCollisionGroupRecursive(object)
  setCollisionGroup(object)
 
  for _, child in ipairs(object:GetChildren()) do
    setCollisionGroupRecursive(child)
  end
end
 
local function resetCollisionGroup(object)
  local previousCollisionGroupId = previousCollisionGroups[object]
  if not previousCollisionGroupId then return end 
 
  local previousCollisionGroupName = PhysicsService:GetCollisionGroupName(previousCollisionGroupId)
  if not previousCollisionGroupName then return end
 
  PhysicsService:SetPartCollisionGroup(object, previousCollisionGroupName)
  previousCollisionGroups[object] = nil
end

local function onEntityAdded(object) -- this is new
	if object:FindFirstChild("Humanoid") == nil then return end -- check if new object have humanoid
	setCollisionGroupRecursive(object)

	object.DescendantAdded:Connect(setCollisionGroup)
	object.DescendantRemoving:Connect(resetCollisionGroup)
end
 
local function onCharacterAdded(character)
  setCollisionGroupRecursive(character)
 
  character.DescendantAdded:Connect(setCollisionGroup)
  character.DescendantRemoving:Connect(resetCollisionGroup)
end
 
local function onPlayerAdded(player)
  player.CharacterAdded:Connect(onCharacterAdded)
end
 
Players.PlayerAdded:Connect(onPlayerAdded)
workspace.DescendantAdded:Connect(onEntityAdded) -- this is new
1 Like