Hey Devforum! Got a question for you.
I have 2 different scenarios that I have, and I’m wondering for each of them if the different parts should be separated into multiple scripts or combined.
Scenario 1:
A bunch of different parts that need to be “flashed”. Should I have scripts in each of the different parts to flash them individually or have 1 script and use for i,v in pairs do?
Scenario 2:
One system, split into 3 parts. The different parts do not talk to each other in any way. Should I contain them in 1 script or split them into 3 different scripts for their respective functions (containing each independent part)?
Thanks in advance for any help, I just don’t want to be massively inefficient or stupid in some other way.
You can split the scripts up for organization sake or you can include all your code in one script. You can learn threading so that all the code will run separately but in the same script.
Okay. Scenario 1 makes more sense to keep it as one, but #2 is different.
Here’s basically what scenario two is:
someEvent:Connect(function()
--does stuff
end)
anotherEvent:Connect(function()
--does stuff
end)
--a few more events are possible
while wait(20) do
--essentially updates a clock and date, checking a database (thats why its not wait(60))
end
Would the script be able to run multiple things like that, or should I split the different functions up? I can see redundancy incase a bizarre error occurs not thought to have been pCalled so it doesn’t take the whole script down with it.
I can’t really get too specific without most likely using you, but essentially its 1 device / system, split in some number of different independent (not communicating, not sharing) functions. I am just wondering if there is a tradeoff between putting it as 1 script and splitting it apart.