I have a few questions in regard to coding optimisations.
Is it okay to have multiple of the same connection in different scripts?
For example having multiple player added connections in multiple scripts. Is that bad? Because I usually do everything in one playeradded connection and it gets complex.
Does having more scripts and module scripts affect optimisation?
Like spamming module scripts for functions.
Is having a lot of variables bad? Yeah I get that it creates places in memory but I dont get the difference.
Why do we use local variables instead of global variables in luau?
yes, but that isn’t a lot of memory to worry about
if you don’t want to create my connections you can make multiple functions and use them in 1 connection
i have created about 1000 connections and it only consumed about 8 megabytes
local Players = game:GetService("Players")
for i=0, 1000 do
Players.PlayerAdded:Connect(function()
for i=0, 100 do
print("EEE")
end
end)
end
Although it doesnt make that much of a difference, it’s still better to put all of your playeradded logic into one connection because it’s easier to manage.