Services
ServerScriptService
A protected server-side hierarchy service for authoritative ServerScripts and other stored instances.
Access
Luau
local ServerScriptService = game:GetService("ServerScriptService")
print(ServerScriptService == game.ServerScriptService)Security
| Name | Type | Description |
|---|---|---|
LoadStringEnabled | boolean | Defaults to false. When enabled in Studio, public ServerScripts may use loadstring(). LocalScripts remain blocked. |
LoadStringEnabled is configured in Studio Properties and saved with the place. Creator scripts cannot change it at runtime.
Keep LoadStringEnabled disabled unless a game specifically requires dynamic server-side Luau compilation. Code compiled by loadstring() keeps the same public ServerScript environment and permissions as the script that compiled it.
ServerScript execution
Enabled creator ServerScript instances under ServerScriptService are discovered by the authoritative server and start once when they become runnable.
| Name | Type | Description |
|---|---|---|
Enabled ServerScript | executes once | Runs as public creator server code when discovered under ServerScriptService. |
Runtime-created or moved ServerScript | discovered | An enabled script starts once after it enters a valid server execution location. |
Client replication | excluded | The ServerScriptService tree is not included in normal client replication. |
ServerScripts under Workspace follow the same discovery rule. ServerScripts stored under ServerStorage, ReplicatedStorage, StarterGui or StarterPlayer remain dormant there.
Hierarchy API
The service root is protected and cannot be renamed, destroyed, dragged, or reparented. Supported instances can be inserted or parented beneath it.
| Name | Type | Description |
|---|---|---|
FindFirstChild(name, recursive?) | method | Finds a child by name. |
FindFirstChildOfClass(className) | method | Finds the first direct child with the exact class name. |
GetChildren() | method | Returns direct children. |
GetDescendants() | method | Returns every descendant. |
IsA(className) | method | Checks the service class or Instance base class. |
GetFullName() | method | Returns ServerScriptService. |
Example
Luau
local ServerScriptService = game:GetService("ServerScriptService")
local scripts = ServerScriptService:GetChildren()
for _, child in ipairs(scripts) do
print(child.Name, child.ClassName)
end