iscorescript Synchronous

Check whether a script belongs to Roblox’s CoreGui, rather than to the game or a player. Use it to leave core scripts out of a script scan.

Syntax
Luau
iscorescript(script: ScriptInstance) -> boolean

Parameters

Function parameters
ParameterTypeDescription
scriptScriptInstanceA LocalScript, Script, or ModuleScript. Any other value raises an error.

Returns

boolean

true when the script is a descendant of CoreGui, otherwise false.

Usage notes

The check follows the script’s current ancestry, so a script moved out of CoreGui reports false.

Example

Example
Luau
for _, scriptInstance in ipairs(getscripts()) do
    if not iscorescript(scriptInstance) then
        print(scriptInstance:GetFullName())
    end
end