iscorescript(instance)
Returns whether a script is a Roblox core script.
Syntax
iscorescript(instance: Instance) -> boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
instance | Instance | Script, LocalScript or ModuleScript to check. |
Returns
| Type | Description |
|---|---|
boolean | true when the script is under CoreGui or CorePackages. |
Description
Walks the script's Parent chain and reports true when a CoreGui or CorePackages ancestor is found. PlayerModule and other regular LocalScripts return false.
The same check is used internally by getscripts so core scripts are excluded from executor results.
Example
local module = game:GetService("Players").LocalPlayer.PlayerScripts:FindFirstChild("PlayerModule")
print(iscorescript(module)) -- false