Restricted/Team Doors

Time:articles/Collision Filtering|collision filtering

In some games, it’s desirable to have doors or forcefields that certain players can pass through but others cannot. For instance, many team combat games will spawn players of each team in a safe area that other teams can’t access (so they aren’t attacked the moment they join or spawn).

There are various ways to accomplish this, but this tutorial utilizes articles/Collision Filtering|collision filtering to create doors that only certain players can pass through.

Creating the Doors

For this simple example, the doors are basic block parts in the workspace named “BlueDoor” and “RedDoor.” Their material is enum/Material|Glass and their BasePart/Transparency|Transparency is set to 0.5.

Collision Groups

Since these doors exist in the game world at the start, we can set up their collision groups immediately. In ServerScriptService, create a Script and paste the following code into it:

Roblox官方链接:Restricted/Team Doors