game

The root of the instance tree, and the way to reach every service.

game is the DataModel at the root of the instance tree. Services sit directly under it, and game:GetService reaches one without a script needing to know where it sits.

Members

game is an Instance, so the shared properties and methods apply: Name, Parent, ClassName, GetChildren, FindFirstChild, and the child signals. See Instance for that list.

Member Returns What it does
GetService(name) Instance Returns the service with that class name.

GetService

Call Result
game:GetService("Players") The Players service.
game:GetService("Workspace") The Workspace service.
game:GetService("Nope") Error: Nope is not a valid service name
part:GetService("Players") Error: GetService is only available on the DataModel (game)

A place has all seventeen services. GetService returns the existing one, so calling it from many scripts is normal. If a service has been removed, the call builds a new one and parents it under game.

Group Services
Engine CoreGui, Lighting, Workspace
Simulation Physics, Perf
Players and input Players, UserInputService
Scripts and sharing ReplicatedStorage, RunService, ServerScriptService
Interface content StarterGui, StarterPlayer, StarterPack
Sound SoundService
Content and data Kits, Store, TweenService

Only services may sit directly under game. Moving anything else there raises an error that ends with only services may live there. Parts and models belong under Workspace.

Example

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

print(game.ClassName)       -- DataModel
print(RunService:IsServer()) -- true on the server, false in a LocalScript
print(#Players:GetPlayers())

See also