Is memory appropriately cleaned from a LocalScript in a Tool if destroyed?

Just need clarification here on if it’s still safe to put LocalScripts in Tools provided all my variables and such are appropriately managed or if I should opt for tool managers in PlayerScripts.

Long story short: I and my team have developed a pretty obsessive habit over not putting LocalScripts in Tools for whatever reason. I can understand not doing this for our weapons systems (ranged and melee) because of the need for uniform logic, but most of our other tools do not need that uniform logic and often have their own needs as far as client-side logic goes.

I’ve mostly tried avoiding putting LocalScripts directly in tools but I value production more and if there isn’t actually any bad practice or bad performance implications here, then I think I’ll scrap some of my tool manager work because it’s just overcomplicating things unnecessarily. It’s not even that big a game.

If I put a LocalScript in a tool which can eventually be destroyed by the server, will it be cleaned up appropriately? Is there anything bad about putting LocalScripts in tools that I should be aware about, or am I just propagating a moot worry?

Looking for answers from people who know, not prospective answers. It might also help to inform me how I can monitor these venues myself as I’m not too familiar with how to use analysis windows to check for potential leaks or technical let-downs. Thanks in advance!

1 Like

I myself don’t put local scripts in tools, I find that if I were to make a big change to the game, for example, adding something new, I would have to edit each and every one of the local scripts(each script is different, but they do have similarities). Instead, I have a main controller on the Server and the Client. The client controls each tools effects, and the server controls each tools functions. The general framework is this:

MainServerScript
    Tool1
    Tool2
    Tool3

MainLocalScript
    Tool1
    Tool2
    Tool3
ToolActivatorActivated -> 
    ServerIdentifiesTool and Abilities -> 
        Functions for Corresponding Tool via Script ->
            Returns Info, Sends to Client ->
                Effects for Corresponding Tool via Local Script

I have used local scripts in tools before, but I haven’t found and issues except the one mentioned above.