I have a car and some walls, I want players and other things to roam freely around the map, but I want the car to collide with the walls (they are invisible.) Hence making sure the cars stay in the area.
How would I do this? CollisionGroupId doesn’t seem to work.
You have to give the walls, cars, and players separate collision groups.
local physicsService = game:GetService('PhysicsService')
physicsService:CreateCollisionGroup('Players')
physicsService:CreateCollisionGroup('Cars')
physicsService:CreateCollisionGroup('Walls')
Then, look at the combinations and think about what you want collidable:
physicsService:CollisionGroupSetCollidable('Cars', 'Walls', true) -- cars and walls should collide with each other
physicsService:CollisionGroupSetCollidable('Cars', 'Players', true) -- cars and players should collide with each other
physicsService:CollisionGroupSetCollidable('Walls', 'Players', false) -- walls and players should not collide with each other