Skip to content

getrunningscripts

getrunningscripts returns a list of all running scripts in the caller's global state. This includes Script, LocalScript, and ModuleScript instances - excluding CoreScripts by default.

function getrunningscripts(): { BaseScript | ModuleScript }

Parameters

Parameter Description
(none) This function takes no parameters.

Example

Checking for active scripts in the session
local running = game.Players.LocalPlayer.Character:FindFirstChild("Animate")
local inactive = Instance.new("LocalScript") -- Not running because no bytecode to run

for _, script in pairs(getrunningscripts()) do
    if script == running then
        print("Found the running Animate script.")
    elseif script == inactive then
        print("This should never print.")
        print("If this did print, then you have just experienced 1 in a quintillion chance of BITS FLIPPING from radiation. Do you live inside a nuclear reactor?")
    end
end