How To Make Invisible Barrier That Only Certain Players Can Pass Through

Hello,
I Want To Add An Invisible Part That Acts As A Barrier But I Want 10 Admins To Be Able To Walk Through It.
How Would I Go About Doing This?

(I Know This Is Probably Really Simple But I Am Not A Scripter And Would Really Appreciate The Help)

1 Like

Roblox servers exist in two ways:

–The Client

–The Server

The Client is what shows on the Players screen. This is everything the player can access, interact with, and use. The Server is everything else - server should be responsible for game logic, saving player data, updating scores, creating parts, etc. You can read more here.

Since you only want certain players to enter it, you have to edit the part on the client. This change will not be replicated/seen by other players. So, in a local script:

local Admins = {
"Infinite_Visions", -- Names of admins
"DrMegaBotYT"--etc. Put a comma for every name
}

local Barriers = workspace.Barriers -- Put a folder named "Barriers" in workspace, and put your barriers in it.

for i = 1, #Admins do -- Loop through admins
	if Admins[i] == game.Players.LocalPlayer.Name then -- If player is an admin
		for i, v in pairs(Barriers:GetChildren()) do -- loop through barriers
			v.CanCollide = false -- make it so you can go through them
		end
	end
end

This should be in a local script, in startergui. Basically, if the player has their name set as an admin, they will be able to walk through all the parts in the forlder “Barriers”.

Thank You So Much!
This Has Really Helped Me Out.

1 Like

No problem, glad to be of service. Just let me know if you have any other questions about the script or how to modify it.