@omar_34
Roblox Oct 22, 2026

How does loadstring work in roblox studio?

Saw loadstring in a tutorial for running code stored as a string on the server. It errors for me. Do I have to enable something in ServerScriptService first, and is it a bad idea security wise?
1

Leave A Reply

Log in to post an answer.

1 Answer

kate_gg Oct 27, 2026
omar_34
it takes a string of lua and turns it into a function you can call. so loadstring("print('hi')")() prints hi. two catches. it's off by default, you have to tick LoadStringEnabled in the properties of ServerScriptService. and it only works in server scripts, never in a local script. honestly though, what are you trying to do with it? running code from a string is the first thing exploiters go looking for, and there's nearly always a cleaner way with modulescripts.