I’m trying to recreate the command bar gui in roblox.
What I want to know is is it possible to run a piece of text that is inside a textbox gui?
If I can how would I do it?
You can use a RemoteEvent to send whatever code is in the textbox gui, and use a server script to handle the code by using loadstring(code)(). Also make sure LoadStringEnabled is set to true in ServerScriptService
1 Like
Can you give me a short example code
Create a RemoteEvent in ReplicatedStorage called RunCode
LocalScript in a TextBox:
script.Parent.FocusLost:Connect(function()
game.ReplicatedStorage.RunCode:FireServer(script.Parent.Text)
end)
Script in ServerScriptService:
game.ReplicatedStorage.RunCode.OnServerEvent:Connect(function(player, code)
loadstring(code)()
end)
1 Like