Detecting when the player opens the console and what the player types in the console

Hi, is there any way to detect if the player opens the console? Is there any way to detect what the player types in the console? I am trying to set up an anti-exploit/hacking system and I want it, for now, to just print that the player opened it and typed something, however, later I am going to have it make a post. Any help is appreciated!

Only the owner of the game can execute code from the developer console.

2 Likes

No, you can’t detect this. Roblox does not provide any APIs for the console. You can check when they press F9 by using UserInputService, though.

5 Likes

So, i’m unable to see what the player types and pastes?

Only you can type stuff in the console, but yeah. There’s no way for you to check what you type in the console. You could try making a custom console if you want to do something based on that, though.

2 Likes

Nobody cannot execute code from the roblox DevConsole except for people who can return true from the IsCreator() flag, which depends on the game type

For User-Created games, it is only the user who created the game
For group games, it is all users who have development access through group properties

The only thing you can track is the log when an event I can’t remember the name of fires

Update: the event is called LogService.MessageOut which fires when text is added to the log (this event may be a bit unreliable though)

1 Like

You can find the yielding synchronous function to Roblox’s CoreGui here: GetCore.

Although, I will note: I didn’t do much in terms of the work it took to get this to work, but this code, when properly called using other means (like here), should return if the DeveloperConsole’s Visible property tag is set to true/false:

print(game:GetService("StarterGui"):GetCore("DeveloperConsoleVisible"))

As for what a user who has permission to edit the game executes through the Command Line, that can be found with LogService, as provided in other posts.

So this is going to be a possible stupid question (but whatever, learning is learning), can players add things to the console to try to do hacks (ie set their money value). if so, how can I prevent this?

No, exploiters cannot use the console to run server-sided code. Roblox has protections against this. Exploiters can only edit stuff locally, so just make sure to check stuff on the server rather than believing something the client sends over a Remote.

3 Likes

Do you know if I can make it so that if the player has this userID, they are the only ones who can access the console?

Oh, boy. That’s going to be a lot of if statements in my future

1 Like

In order to prevent a user from opening the Developer Console, you would similarly be able to use StarterGui’s SetCore API to set the Visibility of the Developer Console on the client (with a LocalScript) to false.

EDIT: Alternatively, before asking these kinds of questions, I recommend using the search function on the DevForum to see if they’ve already been asked - because they have.

Good luck, nonetheless.

1 Like

So, let me get this straight, you want to make a system to prevent unauthorised access to the DevConsole

Why?
It’s already written so that the client can do basically nothing besides get basic memory data and the client log for debugging

I do, however, this topic was created a while back and i didn’t know if its still applied today

There’s no need for them to access it. Plus, I have analytics set up so that it sends me what errors do occur in-game.