Erroring on SetPartCollisionGroup() is incorrect?

When I use the SetPartCollisionGroup() function of the PhysicsService, I get this error:
image
But when I type in the beginning of SetPartCollisionGroup (i.e. phySer:Set) it suggests this:
image

These are contrasting? I’m not sure if I’m going mad because I’ve definitely used this before without error, and I don’t see how something like this would’ve got through all this time, please point out if I’m just being stupid.

Edit: This is what itemGroup is:
image

To be clear I’m not asking why it errored, I figured that out, but the error isn’t right?

It could be argued that “Parameter 2” is the 2nd parameter if you include the “self” argument, i.e. PhysicsService.SetPartCollisionGroup(PhysicsService, part, group)


That was my initial thought. But PhysicsService is actually inconsistent in its numbering!

game.PhysicsService:SetPartCollisionGroup(workspace.Baseplace, nil)

errors with Argument 2 missing or nil

game.PhysicsService:CreateCollisionGroup("test")
game.PhysicsService:SetPartCollisionGroup(workspace, "test")

errors with Parameter 2 must be BasePart in SetPartCollisionGroup.


PhysicsService errors refer to both explicit parameters as parameter 2. Ideally they would be parameter 1 and parameter 2. (And the implicit self would not be numbered at all.)

This is definitely a bug.

2 Likes

“Argument” doesn’t include self, “Parameter” does

1 Like

That’s not the usual distinction.

What is the exact code causing problems? I can add a Part to a collision group fine.

Parameter 2 must be BasePart in SetPartCollisionGroup. is thrown if you try to add a non-BasePart to a collision group. The collision group must already exist. The following code produces the error in a new place:

game.PhysicsService:CreateCollisionGroup("test")
game.PhysicsService:SetPartCollisionGroup(workspace, "test")

Argument 2 missing or nil is thrown if no collision group is provided. The following code produces the error in a new place:

game.PhysicsService:SetPartCollisionGroup(workspace.Baseplace, nil)

The “bug” here is that the error messages are hard to understand. The former error message refers to the first parameter as “Parameter 2”, so it’s hard to understand what it means. It’s expected that the first parameter is referred to as either “Parameter 1” or “Argument 1”.

The latter error message makes sense, but it would be nice if both error messages would converge on either “Parameter” or “Argument”.



Some suggestion error messages:

Argument 1 must be a BasePart in SetPartCollisionGroup. Received <received type here>.

Argument 2 missing or nil

1 Like