How do I search for a line of text in lots of different scripts?

So I am looking for a script that is teleporting people, and I want to search for the keyword “teleport” through all those scripts. The thing is, there are around 200 scripts, and I don’t want to go through all of them one by one. Is there a way I can use a script to search for it?

16 Likes

Yes!

Type Ctrl + Shift + F to do a global script search
(I believe it is Cmd + Shift + F on Mac)

20 Likes

This searches inside the scripts? Like in the code part?

Yes, it does search the content.

1 Like

For future references, could you possibly merge the scripts?

In my case, I always avoid having too many scripts and properly create module scripts named after category of functions.


Did you know there’s a thing called Find Result, that is a dockable window in Studio which allows you to search certain keywords?

2 Likes

Is there any way I can do this through a script?

It’s probably easier to just use the global search, but yes. You can loop through everything and check if it’s a script, then check its source. Keep in mind this only works in the command bar or a plugin:

for _, child in pairs(game:GetDescendants()) do
	local canAccess, isScript = pcall(function() -- if it's roblox locked, this will error
		return child:IsA("Script")
	end)

	if canAccess and isScript and child.Source:match("teleport") then
		-- if it's not robloxlocked, it's a script, and it says teleport (somewhere) then print where it is
		print(child:GetFullName())
	end
end
5 Likes

OP is actually looking to find a vulnerability in their game that’s teleporting their players to another game. Found this out through another thread (all the threads should have been condensed rather than separate threads for smaller questions).

This works, tysm!This helps me a lot by far