How can I make a part that lets everything through except for the player?

Hi! So I wanted to make a part, that lets for example NPCs through but not the player. How can I do that?

Thanks for reading!

1 Like

Have you tried to do this with collision groups?

How can I do that, or where, beacuse I couldn’t find it anywhere.

Try this tutorial: Collision Filtering | Roblox Creator Documentation

local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
local Wall = --path to the wall

PhysicsService:CollisionGroupSetCollidable("Characters", "Walls", false)

Wall.CollisionGroup = "Walls"

local function onDescendantAdded(descendant)
    -- Set collision group for any part descendant
    if descendant:IsA("BasePart") then
        descendant.CollisionGroup = "Characters"

local function onCharacterAdded(character)
    -- Process existing and new descendants for physics setup
    for _, descendant in pairs(character:GetDescendants()) do

    -- Detect when the player's character is added

This is the only way so far, but there should be a better way like with NoCollisionConstraints. Paging The opposite of NoCollisionConstraint: CollisionConstraint

1 Like

Thanks, but this script lets me go through the wall, and not the NPCs, how can I fix that?

One way to do this is by creating a script that checks the player’s identity and applies a different set of rules to NPCs than to the player. You could also use a Scripted Part or a SurfaceGUI to block the player’s character from entering the area but allow NPCs to pass through. You could also use the Players/GetPlayerFromCharacter() function to check if a character is a player or NPC and apply different rules accordingly.