SetCore: DeveloperConsoleVisible

Just added yesterday. Should work in production studio and client.
In a localscript, run:

local devConsoleVisible = game.StarterGui:GetCore("DeveloperConsoleVisible")
game.StarterGui:SetCore("DeveloperConsoleVisible", not devConsoleVisible)

Thank @Xsitsu

25 Likes

Could you make some more info about this.

Does it change any security mesures like “server info only for owner”?
Does it mean that the gui can’t be removed, as it’s run when the game starts?
Does it mean that the console will open if you reset?

Does it mean that you can dissable the console all over the game, so no one can check it?

It’s localscript only and the equivalent of pressing F9 or typing /console locally.
Nothing else has changed.

4 Likes

Any chance we could get StarterGui.CoreChanged (event)? It’s not really needed for the other Get/SetCore methods since those are all developer-controlled, but DeveloperConsoleVisible can be modified by the user. If I want to listen for when the developer console opens/closes, my only option at the moment is to check GetCore(“DeveloperConsoleVisible”) on Heartbeat.

Use cases:

  • “Add” (show alongside of) various other metric displays specific to my game to the developer console so I don’t have to have multiple keybinds
  • Revert custom mouse icon set through Mouse.Icon to default so I can use console
  • Rebind the developer console to a different key (for instance if I want to free up the F9 key so I can use F1-F10 as keybinds for my game – really helpful in games where you want to quick-select different groups of items (soldiers in an RTS, change hotbar in RPG/building games, etc))

You can implement this event by polling the getcore method, and it doesn’t need to be on heartbeat. This shouldn’t be a performance problem.

What happens when a player opens it through the menu on XBox, and what happens when there’s a way to open the console through the menu on PC? I can’t hook into InputBegan or Chatted to check when the developer console is opened. It’d have to be on Heartbeat.

It’s not a performance issue – it’s a UX problem. Events communicate when something changes – that’s what they’re for, and when you want to listen to when something changes you use an event and not continual polling. Everything else on ROBLOX utilizes events (even UserGameSettings), so I’m not sure why this should be the odd one out.

local evt = Instance.new("BindableEvent", game.Workspace)

evt.Event:Connect(function(val)
	print("dev console action ", val)
end)

local last = false
while true do
	local cur = game.StarterGui:GetCore("DeveloperConsoleVisible")	
	if last ~= cur then
		evt:Fire(cur)
	end	
	last = cur
	wait(0.25)
end

We’re generally not going to implement something that’s quite so trivially doable in lua. This is also a very specific (and uncommon) use case.