If i disable the local script, will the memory be cleared?

if I disable a script I know that the events will not be detected and also when it is activated it restarts, but I have doubts that may seem silly, when I disable it, it cleans the memory occupied by the local script, the functions, tables, all of this.

Scripts don’t stop running when they’re Destroyed or Disabled, and so any objects they’re keeping alive won’t be cleaned up just from doing that. For example:

script.Disabled = true
local a = Instance.new("Part", game.Workspace)
while wait(1) do

If you do this in a place with no base plate, the newly created part falls to it’s death and the script prints “Died”. From this you can see that the connection object sticks around after the script is Disabled, and also that the script keeps running in general.

In general, I would refrain from using destroying or disabling scripts to control logic.