Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Enabling Developer Console for only a certain list of people?

This is a localscript in StarterGui. This basically sees if a player is allowed to see the Developer Console from the whiteList and then if the player is allowed then the Developer Console is enabled and if not, it's disabled.

local player = game:GetService("Players").LocalPlayer
local starterGui = game:GetService("StarterGui")
	
local whiteList = {
		"Precisionly",
		"killzone45671",
		"CommanderSkywalkerTR",
		"Versatrax",
		"Tragedy_Blue",
		"DcMultiVerseParadox",
	}

game["Run Service"].RenderStepped:wait()
if starterGui:GetCore("DeveloperConsoleVisible") then
	if not whiteList[player.Name] then
		starterGui:SetCore("DeveloperConsoleVisible", false)
	end
end

1 answer

✓ Accepted answer

You can't check if something is part of a table like that. You'll have to write a function that loops through the table, and matches any values with those inside the table.

It'll look something like this:

local function FindValueInTable(tbl, val)
	for _,v in next, tbl do
		if v == val then
			return true
		end
	end
	return false
end

Also you'll need to put a loop on making the DeveloperConsole visible.

local plr = game.Players.LocalPlayer
local gui = game.StarterGui

local whitelist = {
	"AlreadyPro"
}

local function FindValueInTable(tbl, val)
	for _,v in next, tbl do
		if v == val then
			return true
		end
	end
	return false
end

game:GetService("RunService").RenderStepped:Connect(function()
	if FindValueInTable(whitelist, plr.Name) then
		return
	elseif gui:GetCore("DeveloperConsoleVisible") then
		gui:SetCore("DeveloperConsoleVisible", false)
	end
end)

2 comments

0

On line 9, would "for i,v in pairs(tbl) do" work?

0

Yes, but next is faster than pairs and looks neater.

This discussion is preserved as it was. New answers, comments, and votes are closed.