How do I log commands that I put in dev console?

So I’m a developer for a game, and the owner requested that I log what someone is putting into the command bar in dev console, but I don’t know how to do it. Can someone help?


Btw I’m not trying to log only that one command, I wanna log anything that someone types into the command bar in the dev console. I also don’t want to log script outputs, only console outputs that were manually typed from a developer

I don’t think you can because you send this as the server.

As what i found you can only know when someone open it.

How would I go about doing that?

Maybe you can try to catch any output message (Enum.MessageType.Output) from the LogService and then check if there is a developer in the server? (this method won’t work as expected with a server including multiple devs)

Already tryed that but wont work perfectly i don’t know how we can done that i think that not possible because that Roblox Side and just not possible.

game:GetService("LogService").MessageOut:Connect(function(message, messageType)
	if messageType == Enum.MessageType.MessageOutput then
		print(message)
	end
end)

It is not possible to detect when a developer opens the developer console in Roblox using Lua. The developer console is a tool for developers to use for testing and debugging their games, and it is not intended to be accessed by players. As a result, there is no built-in way to detect when it is being used.

It is not possible to determine who made the output, but we can guess who might have made it. You can also check if the messages starts with local(s) and Lua syntax, Idk.

if they execute code you will never catch it.

I already tryed it in the past and impossible looked for more 12hours sometimes but nothing.

Lua syntax matching?

You just can’t get the output and can’t know if it’s a player did it or a script, localscript, module.

Why not check if the log message starts with > ?

That’s about as perfect as it can get, since nothing uses (or should be using) > at the start of the message unless it’s intended to be a command of some sort.
As for seeing who executed the command though, that is impossible.

Try to do it then, i don’t think you can ?

-- Server
game:GetService("LogService").MessageOut:Connect(function(message, messageType)
	local command = message:match("^> (.*)")

	if messageType == Enum.MessageType.MessageOutput and command then
		warn("Command executed:", command)
	end
end)

image

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.