So I would say I can script a lot of things (like generic simulator games which seem to flood the front page nowadays), but I'm at the point where I am optimising performance and could HUGE scripts (1000 lines+) take up memory usage? If not, what is the biggest factors. I know this is not necessarily script related but uno
Since there's more code, there's more Lua has to compile. So technically, yes. However, this is a minute factor and most likely won't affect your game in the slightest, assuming your code is well-optimized. For example: using Destroy()
instead of Remove()
.
Hope I helped!
As I mentioned before, the amount of memory consumed by Roblox has NOTHING to do with the size of your scripts. Every script in your game is passed through an online cloud and is delivered that way. Your computer's RAM does not (at ALL) influence how these scripts run; it's all in the connection between the game's IP address and Roblox's main server.
You would also be interested to know what DOES affect the amount of memory consumed by Roblox. I narrowed these down to 2 main causes:
How much RAM your computer has
The intensity of the graphics pool when it delivers graphics to Roblox on a selected GPU
The first cause doesn't usually happen, but the second cause is VERY common, especially with discrete GPUs. For instance, if you have 8 GB of RAM and a discrete NVIDIA GPU, the GPU takes first action by activating its pool for Roblox to use. The larger that pool is, the more RAM Roblox may be required to use to force an equilibrium with the graphics pool. The amount of RAM Roblox uses usually doesn't go beyond 400 MB, but in rare cases such as the one above, Roblox may use up to 500 MB. (Roblox will never use 1 GB of memory, so don't worry about that.) Another cause not listed may be your computer's resolution. 4K computers tend to really force Roblox to try to match up with it, which results in more RAM being used by Roblox.
The only instance where a script may use more memory is if that script is loaded directly from your computer's boot drive. The system then controls the RAM that script uses. What Color3fromRGB was mentioning was raw Lua, NOT Roblox Lua. Only pure Lua code uses your RAM; Roblox Lua code doesn't usually do this. That's all I have to say.