How can I make a zone only accessible for certains users?

So I basically want to make a staff room, where only some users that I choose can enter. How can I do that?

Also I know that it would work if I just gives a badge to these users but I don’t want to create a badge just for that. If it’s the only solution well, I will do that.

I searched on Google but I found nothing that could really work, maybe I missed something.

Thanks in advance, happy developing!

You could make a localscript check the grouprank, if the grouprank is good. Make the parts where they are allowed to enter cancollide off. You could use a whole part so you know when someone is exploiting or block only the door.

1 Like
  1. Create a table with the PlayerIDs of the players you want to enter the staff room
    I’ll use the ZonePlus module to allow better hit registrations. You may wish to add it to your game if you choose to use this code: ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries
  2. Place this code into a Local Script in StarterPlayerScripts
local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = game:GetService("Workspace").CheckPart
local allowpart = game:GetService("Workspace").AllowPart
local zone = Zone.new(container)

local allowedplayers = {} -- enter player user IDs here. Separate with commas.

zone.playerEntered:Connect(function(plr)
	local check = table.find(allowedplayers, plr.UserId)
	if check ~= nil then
		allowpart.CanCollide = false
	else
		allowpart.CanCollide = true
	end
end)

CheckPart is a large, invisible, uncollidable part placed in front of Allowpart. It must have CanQuery on.
AllowPart is the door to the staff room.

3 Likes

@DeEchteBelg

I prefer not to create another rank in my group because I’m pretty poor…

@ValtryekRBLX

I will try that, thank you very much!!

Thanks to you two for helping, have a great day!

2 Likes