Understanding this error code of Physics Service

local ps = game:GetService("PhysicsService")
local physicsGroup = tostring(script.Parent.ID.Value)
local emptyGroup = "empty"
ps:CreateCollisionGroup(physicsGroup)
ps:CreateCollisionGroup(emptyGroup)
ps:CollisionGroupSetCollidable(physicsGroup, physicsGroup, false)
ps:CollisionGroupSetCollidable(emptyGroup, emptyGroup, true)
ps:SetPartCollisionGroup(script.Parent.TriggerZone, physicsGroup)

The error happens at this piece of code

ps:CreateCollisionGroup(emptyGroup)

The console says

15:58:05.839 - Could not create collision group, one with that name already exists.

15:58:05.840 - Stack Begin

15:58:05.840 - Script ‘Workspace.Garages.UniqueUnit.AuctionScript’, Line 18

Things to note is I am creating multiple groups. I have been warned about there being a limit but I don’t remember. It was working before I added this extra group. And I have 30 scripts doing this.

1 Like

Just rename your ‘emptyGroup’ variable to something else.

Check your collision groups tab, and every other line where you create a collision group. You’re creating the group “empty” twice, somewhere. You can Ctrl+Shift+F to search ALL scripts for something. I would suggesting Ctrl+Shift+F’ing and searching for “:CreateCollisionGroup”, and looking for any other instance/s where you create a group named “empty”.

It was actually originally called “default” but it brought the same error

I have already checked my scripts

Have you checked your collision group tab itself? The error says you’re creating a group where one already exists.

I fixed it by simply making only 2 collision groups instead of instancing them in every script as the same