I come from Unity 3D, where it's encouraged to use different scripts for different purposes. Such as one script may handle game mechanics, one may handle user's stats, etc. In this environment, you can access members and properties of different classes, but I'm seeing that the only way to do this in Roblox/Lua is with modules or something similar.
Therefore, my question is, should I handle most, if not all, of my server actions in a single script? How am I expected to access members of one script from another? Do most people just slap on some IntValues, ObjectValues, etc. and read from those? Is this not exposing the client to potential exploits?
I'm very new to Roblox's coding environment, so I hope you understand where I'm coming from, it's just strange to feel as if it's limited in the sense that there isn't much access between different components
Thanks
Depends what said "Different Purposes" are.If it would work best with script.Parent
rather than game.Workspace.Model.Model.Model.Model.Thruster
, than yeah it's recommended. But if it's something like purchases handling and leaderstat setup, than no. I would recommend using things to do similar things in one script. Other than that, do it in multiple scripts.
In general, if they are related, then yes. If they are unrelated purposes, than no.
As for the values, yes. Just make sure to do some anti-hack scripts. I can type one out if you need it. But, you need a bool value and another value, which most hackers won't see through right then and there. So, basically, yes, most people just slap on some IntValues, ObjectValues, etc. and read from those. ALSO: You have to use values for stuff like leaderstat values (the stats that are up on the player view menu). You also gatta either keep the leaderstats folder/value stored or use Instance.new
for each member of the leaderstats stuff.