Too many scripts open in Studio

I have this game that i want to work on, And when i open it in studio, it takes a good 2 minutes to open (I have a good PC so the problem is not the game’s content) and when it does open, it’s very slow and lags when i try to do things (like selecting objects)

I believe the reason is because when i used to work on it a lot, i had a bunch of scripts open and never thought to close them, which is an issue now.

I have tried to search for ways to do this but none have helped, There is one post where someone suggests deleting the “IDE state” of the place, which i have done, but didn’t change anything.
They also suggested just using the “Close All Scripts” thing but that’s just gonna lag and probably just freeze studio and not work.
I would just manually close each script, but that would probably take a few hours since there is a lot of scripts and it freezes for a few seconds every time i close a script

Any help is appreciated

If “Close All Scripts” does not work for you, then I don’t know what will. Upgrade your computer.

You can try running this in the command line, a hacky way to close all scripts:

for _: number, descendant: Instance in game:GetDescendants() do
	if descendant:IsA("LuaSourceContainer") == true then
		local parent: Instance? = descendant.Parent
		descendant.Parent = nil
		descendant.Parent = parent
	end
end
3 Likes

This code just freezes studio (on the place with all the scripts open, also yes i did add a 1 second cooldown to it so it wouldn’t freeze studio but it still did)

I think i would have to have a really good computer to run something like this smoothly, because when i mean a lot of scripts, i don’t mean like 20 or so, i mean like hundreds.
Even if i upgrade my computer, it’s still hard to navigate the scripts when all of them are open.

it goes throught ALL the Descendants even coregui i think… and other hidden ones

1 Like

It doesn’t lag on my other places though, and it closes all the scripts just fine. I don’t think the problem is that it goes through all of the game’s descendants, It’s just that i have too many scripts open in that specific place, so when it does close them it just freezes (i should’ve closed them when i was working on this game a lot but i didn’t really think that would cause lag)

1 Like

yeah but you could just right click the script (tab not explorer) and close the tabs to the right i think

1 Like

This does the same thing as closing the script manually.