Well first of all, imo globals are disguisting, so I would immediately make that a local instead.
Now I was kind of just talking about this to my friend, not in the event sense, but in overall using one-time functions and just hoping they get garbage collected quickly enough for it not to be a problem.
In this case, for example this code of mine:
In this case, I’m constructing a function in runtime, everytime, (when I didn’t need to), which first of all in a lot of cases can look weird, and also is bad for memory use.
You should cache your function if you’re gonna be connecting or disconnecting it multiple times.
Now,
Recently I updated that script and so now it’s a local function which is the only one used for every thing.
Constructing a new function each time for everything is slower and usually unnecessary, so to anyone reading, next time you write something, check if you can’t cache these into just one function which is shared for multiple things.
If you wanna be specific to your script, then whatever. (Except for the fact that you’re using a global)
However if you’re working for example with parts that damage / kill a player then the better thing to do here is to use CollectionService and handle everything in only one script.
While that’s better, the things I talked about above with function caching still apply. If you’re doing the exact same function everytime, check again to see if you REALLY need to construct a function everytime.
That’s just because it follows the older code style from the past.
For instance, not using locals (sin, you’re not going to heaven if you use globals 

)
And also stuff like not localizing game.Workspace.Part
to Part
(performance loss too), not using :GetService
, having main functions being named with camelCase
and not PascalCase
, etc.
Most modern code looks just fine with the style 2 as long as they follow the newer standards.
local Players = game:GetService("Players")
local function OnPlayerAdded(player)
--\\ :)
end
Players.PlayerAdded:Connect(OnPlayerAdded)
for _, player in ipairs(Players:GetPlayers()) do
task.defer(OnPlayerAdded, player)
end