Can you execute code in a game without much use of the developer console?

So Im not sure if this is the right topic but im trying to create a gui which would execute code similarly to the developer console. What I want it to do is execute code the player inputs in the game, they can use. I had a look on youtube and the dev forums and im not sure you can they can use this limited commands do to specific tasks. Like changing a zombies health to 0 without actually being allowed to delete it from the game. It’s an idea but from what I saw im not sure its possible without using the plugin. I also don’t want to rely on the developers console because it’d be the average player who wouldn’t be able to use it.

1 Like

Are you looking for something like this?

It sounds like you’re looking for an ‘admin commands’ type system.

Take a look at this post: How to make basic admin commands

It’s quite close but what I was aiming of doing it basically having the roblox studio script gui/panel as something in the game. But restricted. So it’d just be the developer console but allowed to be used by everyone and restricted

The closest I can think of then is using a TextBox gui and a very simplified set of commands to parse out of it

Close, but I’d like it to be like the lua panel/gui from roblox studio. In Lua Learning it’s a gui inside the game which lets you execute code and learn lua doing so if im not mistaken. I’d like to use or try and have an idea of how to make it without having to add alot of commands etc…

I believe the thing you are looking for is called loadstring.

Here’s an example:

-- Server Script --
game:GetService("ReplicatedStorage").Execute.OnServerEvent:Connect(function(plr, contents)
    if plr.UserId == game.CreatorId then
-- Local Script --
game:GetService("ReplicatedStorage").Execute:FireServer("print(\"Hello world\")")

Make sure LoadstringEnabled is enabled in ServerScriptService properties.

1 Like

Thanks, but I’m not really sure this is the best for security. Exploiters have an advantage locally so couldn’t they just use the exact same script if I enabled it? I haven’t heard much about it before so im not that familiar with it. Thanks again

It’s safe because in @Med_App’s code the server is verifying that the player who sent the code is the game owner before running it.

Exploiters can only “create” local scripts not server scripts.
So it’s fine to enable LoadstringEnabled.

Thanks for the letting me know. I’ll try and add it into my code.