Codectionary / Developer documentation / Luau

Collision groups

Configure which groups of physical parts can collide.

Why use WorldRoot?

Collision groups let a game define rules such as projectiles passing through teammates. Current group configuration methods are on WorldRoot; older PhysicsService group methods are deprecated in Creator Hub.

Try it in Roblox Studio

Put this Script in ServerScriptService. Create a BasePart named GhostPart in Workspace and test it against another part assigned to the same Ghosts group.

Syntax

workspace:RegisterCollisionGroup("Ghosts")
workspace:CollisionGroupSetCollidable("Ghosts", "Ghosts", false)

Examples

Collision groups

Make members of one collision group pass through each other.

local group = "Ghosts"
if not workspace:IsCollisionGroupRegistered(group) then
    workspace:RegisterCollisionGroup(group)
end
workspace:CollisionGroupSetCollidable(group, group, false)

local part = workspace:WaitForChild("GhostPart")
assert(part:IsA("BasePart"))
part.CollisionGroup = group
  1. The existence check avoids registering the same group twice.
  2. CollisionGroupSetCollidable sets the pairwise rule for Ghosts against Ghosts.
  3. Assigning a Part to the group applies that rule when it meets another member; it does not make the Part noncollidable against every group.

Best practices

  • Document each collision-group pair your game uses.
  • Use the current WorldRoot API rather than deprecated PhysicsService registration methods.

Runtime & versions

Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.

Luau documentation

Specifications & further reading