I have a computer screen setup with a surface gui and a frame (im going to make the player camera point at it later). What i want to achieve is the ability to write multiple lines of code on the computer screen aswell as perhaps adding new lines when the begining ones are filled. Then after the script is done u can press a button and send it to some server script which makes it a loadstring and if theres an error a notification on the computer screen will pop up. (Aswell as a clear button to wipe the code after, and another thing the little flashing underscore at the current end of the script as in some computers)
The problem is even with this idea im not very good at making gui and have really no idea how to make the multiple lines part or the notification.
I can propably write most of the script myself i just dont know how to begin with the ui or how to actually handle it.
Terminal ig, like the built in roblox console but physical (but it’d have lines like a script that add when u fill the last one, i should propably make a scrolling frame)
you can make a string show multiple lines in a string by using \n
to make the flashing undescore you could probably just make a loop where it shows the normal string and then shows the string with the underscore on a interval.
You’ll need to enabled loadstring in ServerScriptService manually.
You can detect inputs using the UserInputService.InputBegan event. There is an example in the docs here. You can check the key that was pressed with input.KeyCode. You can convert an Enum.KeyCode to a letter using something like input.KeyCode.Name (though make sure to only do this for letter Keycodes, the ones for space are named something like “Space” instead of “A”, “B”, etc.
You can use pcall to run the code and get the error as a string. pcall runs a function and returns a boolean for success and a string for the error code (if success is false).
You can detect when the Keycode.Name is “Return” then append "\n" for newlines. (You can also do tabs using "\t".) Here are the names of the Keycodes.
You can send data between the client and server with remote events.
You can add the UI to a part using a SurfaceGui. You’ll need to mess with the SurfaceGui’s properties to get it on the screen right (e.g. setting the size and position). You can then add a TextLabel to the SurfaceGui for the text. You can add buttons using TextButtons or ImageButtons.
To start a session, you can choose a number of options. One easy one might be a seat (using the Seat:GetPropertyChangedSignal("Occupant") event), or using a ProximityPrompt (using the ProximityPrompt.Triggered event). I would probably right this code client sided.
Once the player starts a session, create a connection to UIS.InputBegan for the keycodes. Also set the character to have zero walkspeed if you’re using a ProximityPrompt so they don’t walk around while typing. You could use the Escape key to exit the session, or a button on the screen.
You can also have a connection between your “run” TextButton/ImageButton on the screen and sending a remote event to the server. The event for this is TextButton.Activated.
Also another note, you’ll need to sandbox the code your players are able to write otherwise they’ll be able to make bad content, access your datastores, kick players, and even potentially platform-ban players using bugs (I don’t think they’d be able to because it would need to create LocalScripts, which should be Script permission).
Yeah i know about loadstrings, ive utilized them before same with the pcall. Ive been thinking about using the input without really typing just adding them to a textlabel or smth onscreen. I already have the surfacegui set up and the remote event is how im planning to send the string to the server. And about the seat, thats what i planned before. Overall i am very thankfull for your help as it helped me ground the idea better, tomorrow i will try to script and hopefully test it as it is quite late.