Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why did users use Scripts to create new Scripts?

What I mean: I looked at really, really old Scripts and Codes from 2008 or 2009-2011, and I saw this certain type of code that looks like this:

local Script = Instance.new("Script")
Script.Source = [[print("Hello, User!")]]
Script.Parent = game.Workspace

--Or

local String = "m/Hello, User!"
local Script = Instance.new("Script")
Script.Source = string.sub(msg,3)
Script.Parent = game.Workspace

So, as the title says, why did users do this back then using Normal Scripts? I question: Why did users do this back then, and what was the main purpose of this?

1 answer

✓ Accepted answer

For the most part, there isn't a good reason. A combination of coroutines and loadstring get the same result as creating a Script object (but loadstring should be frowned upon anyway).

Probably a lot of it came from ignorance of loadstring and coroutines. Since there were fewer script-writers, and they had been working with ROBLOX for less time, there wasn't as much information on how to do things like that as there is now.


Some of it might have been for obfuscation; you get one complicated script that unpacks itself to do other things (though this can be defeated anyway).


One uncommon but reasonable use was to save extremely large amounts of data neatly. You may recall that ROBLOX used to prompt owners of a place to "Save" when they left. If you had large amounts of data (as opposed to just models) that you wanted to save, it might be convenient to store it in a Script -- they have very large maximum lengths and support newlines. If you were interested in that, you could even make it produce a valid script that restores whatever you wanted it to.

2 comments

0

So, the reason they did it back then was because they were limited to what they could do with the Language at the time? Also, as you've said, that I could even make a Valid script that restores data, I don't understand how users are able to do that without having to save it to a Model on ROBLOX, or saving it as a file on their Computer?

0

Alpha, you can save the properties of the parts within a table. Then you can get the script to interpret that table and 'restore' the previous instances.

This discussion is preserved as it was. New answers, comments, and votes are closed.