How'd I solve this collision group problem?

Currently I’m working on Team collisions, where player in a team can collide with their teammates but not with the other team. When a team is being added, it will add a new collision group and assign the team’s player to it.
Everything works fine until I ran into a problem: Is it possible to assign a part to 2 collision groups?

I have a collision group where parts inside the group can’t collide players, that collision group exists all the time, however if I apply the team collision group, the player will lost the original collision group.

Is there any ways to perform both tasks at the same time?


It seems that these two collision groups are contradictory to begin with - one that allows for no collisions between players and one that allows for “some” collisions unless I am just misunderstanding you.

If I do understand you correctly though, what’s the point in trying to squeeze a set of parts into two collision groups that counteract each other?

Alternatively, a different interpretation of what you mean, you could assign collision groups to these “parts inside the group that can’t collide with players” instead of assigning them to the player’s base parts themselves.

You would use collidiongroups for this.

Let’s say you have 2 teams: Team A and B.

You would make a collision group for both teams, and set the collision for A and B to true. You would then set the collision for A and A and B and B to false. Then you would loop through the players character and set their collision group to their respective team.

Don’t forget, every time the character respawn you would need to reset collision groups because it’s creating a New collision group which is still set to the default collision group.

How’d I assign “parts inside the group that can’t collide with players” not to collide players without creating 2 collision groups?

You can’t do that, just make two seperate groups. And why would you need to make you able to collide with your team? Wouldn’t that lead to more consequences, like being able to push them off places when they’re afk, or messing up firefights by running into a teammate?