Textbox as in-game code runner

Yes, how?? Any reference or something? But i want not only like print but can also like Instance.new etc

Maybe this might help -

If I understood you right

But i want to take the input from textbox , so this textbox is like script runner/script editor.

Theoretically, you could use loadstring() and LogService to do so. You could get the loadstring, then get the log history. After that you could call the loadstring and then every time LogService.MessageOut is fired, that would be from the loadstring, and when it stops, you could put those into the output.

Is like Command Bar on Roblox Studio / Script Runner on Roblox Studio, but we can do it in-game.

Like @eaterofananas8 said: You could use loadstring() to run the Code. But that’s not the best idea as enabling this would give exploiters alot of power - Technically not alot but would also let them do more bad stuff than they can already do.

If you’re looking towards a very amazing and reliable command bar, You could try using Cmdr since it’s the best Command Bar to be implemented into games so far and it also comes with alot of things, So it’s pretty much very customizable.

You know, not only print but also can make gui or frame, etc.

If you’re giving them access to a code runner, then exploiting would be pretty much pointless as you can already run any code you want.*

Let’s say in the textbox I write

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local frame = Instance.new("Frame")
frame.Name = "Test"
frame.Parent = Player.PlayerGui:FindFirstChild("TestGui")

It will make frame to my TestGui ScreenGui

No, this is more into for testing.

Lua Learning Like this game

That’s not a code runner but a Command Bar. It allows you to execute certain pieces of code such as Commands to teleport Players, Give them a certain amount of money and in-between alot of more things that yourself should implement.

By the way, Using code executors in your game can lead to your account possibly being banned, There’s alot of people that already got their accounts punished for doing so. If you want to create a code executor, Then do it, But don’t get surprised if you get a warning.

You are correct, but they wanted a code runner, not a command bar, and I wasn’t talking about Cmdr.

Maybe you can see the reference game that I was talking about

Like i mentioned before:

That’s not my problem if they want to do it, But i’m just letting them know what are the consequences of doing so.

If you want to allow players to be able to run any code in-game (like @MeCrunchAstroX said, can get your account in trouble), so be it.

But if you only want them to run code like printing and such, then I would suggest filtering out any lines that have any reference to the objects in game (such as Instance.new(), script, game, workspace, etc).

Ah maybe that’s a good idea, i mean only for print is no problem right? and how to make if in the code they have print, it will be output to my output GUI same like how Command Bar on roblox studio do when you have print on your script.


Something like this, this is not with code, just example GUI

Is there a way? thank you. I already do it with LuaVM (Parser without Loadstring) and also already try to use Loadstring and it works, but how to put the output in the GUI.

I finally work with LogService.MessageOut or is there any better idea?