Is it possible to detect a script that uses certain services such as TeleportService?

My game might possibly have a backdoor script but I don’t know where to find it… the only thing that I suspected is the obfuscated script for RankTagV2.

Scenario:

  • Ingame:
    – A certain error popup because the game doesn’t allow API for 3rd party teleportation (to teleport into another game that is unrelated to the current game)
    – It shows the warning in the Local console. (It’s possible that it was made in the local script)

  • Studio:
    – It seems the error/warning doesn’t pop up. The code must be used a detection to know if it is running in the studio or not.

I want to know if the obfuscated script is the suspect in this problem because when I tried to disable it and run it in-game, the teleport still pops up.

Also, the warning that tells the invalidation of teleporting to another place doesn’t have a location from where it came from, So, I really don’t know where to fix it.

If you use the key shortcut CTRL + SHIFT + F and type in the Service you wanted to find then it should show up there. If I were to do it by a script, then no, there is no possible way to do this (to my thinking).

1 Like

I came up with this:

--The script should be pasted and run inside the studio console
function toBytes(word)
	local bytes = ""
	for i = 1, word:len() do 
		local letter = word:sub(i, i)
		bytes ..= "\\"..letter:byte()
	end
	return bytes
end

local Names = {"TeleportService", "Teleport Service"}
for _, name in pairs(Names) do 
	table.insert(Names, toBytes(name))
end

for _, service in pairs(game:GetChildren()) do 
	pcall(function()
		for _, object in pairs(service:GetDescendants()) do 
			if not object:IsA("LuaSourceContainer") then continue end 
			for _, name in pairs(Names) do 
				if object.Source:find(name) then 
					print("DETECTED AT LOCATION", "game."..object:GetFullName())
					break 
				end
			end
		end
	end)
end

It will detect any scripts that directly reference game["Teleport Service"] or game:GetService("TeleportService") and the scripts that represent them as byte characters. The script can’t detect other methods of encryption or scripts that are added after it runs.

2 Likes
local Game = game

local Service = "" --Name of service.

for _, Child in ipairs(Game:GetChildren()) do
	local Success, Result = pcall(function() return Child:GetDescendants() end)
	if not (Success and Result) then continue end
	for _, Descendant in ipairs(Result) do
		if not (Descendant:IsA("LuaSourceContainer")) then continue end
		if not string.find(Descendant.Source, Service) then continue end
		print(Service.." found in "..Descendant:GetFullName())
	end
end
1 Like