I’m trying to let 2 different teams of players to collide with each other but they’re not allowed to collide their own teammates.
I’m relatively new on using PhysicsService and I’ve read some of the threads about it, i’m wondering if there’s 10 teams, do I need 10 Collision groups? If so, do I create a Collision group upon a team is being added and set all player’s character’s BasePart to it and turn off the collisions on all other Team’s Collision group? How?
If you only need to worry about 2 teams, you can use the built in Collision Group Editor to make this easier for you. As an example:
if you want to do this via script, all you have to do is something like this:
for _,Team in ipairs(game.Teams:GetTeams()) do
PhysicsService:CreateCollisionGroup(Team.Name)
PhysicsService:CollisionGroupSetCollidable(Team.Name, Team.Name, false)
end
Then Player-wise just create a CharacterAdded event to set each descendant part of the Character to their corresponding team.