Wondering how I could make a Lua sandbox in game. The sandbox would allow players to give an output in a custom output box, while also making sure they cannot modify any of the game’s scripts and local scripts. Thank you in advance, and if you need any clarification on anything I will be happy to clarify!
First enable loadstring then write a script like this (put it in a TextBox)
local box = Instance.new('TextBox') local text = '' box.FocusLost:Connect(function() text = box.Text end) box.Focused:Connect(function() box.Text = text end) box.FocusLost:Connect(function(enter, input) if enter then print('enter') loadstring(box.Text) end end)
Cool, I got that. One last thing (probably), how in the world is indentation and new lines created. With a textBox you can’t really do much. Would you create a new textbox every line? Wait. I think a textbox is able to create new lines if you press enter if I’m not mistaken… Or I’m terribly wrong.