Game
Inherits from Instance
This object can be accessed in scripts by using the game keyword.
Game is the root object in the Polytoria instance tree. It is the object from which everything is descended.
Not CreatableSummary
Properties
GameID:intInstanceCount:intLocalInstanceCount:intPlayersConnected:intRead Only
Events
Rendered:void
Details
All services and everything are stored under the game data model.
The game global also provides you with the Rendered event which you can use to run something at the frames of the client or the server.
The Polytoria game server runs at 30 frames. The Rendered event on a server script will run 30 times per second.
Properties
GameID
Game.GameID: int
The ID of the current Polytoria place.
Example
print(game.GameID)
0 when testing locally through Polytoria Creator, which can be used as a conditional to check if the place is live or not.InstanceCount
Game.InstanceCount: int
The total number of instances currently loaded.
Example
print(game.InstanceCount)
The value will differ depending on if it is being accessed through a Script or a LocalScript, as LocalScripts can only see instances that are relevant to the client.
LocalInstanceCount
Game.LocalInstanceCount: int
The number of instances currently loaded on the client.
Example
print(game.LocalInstanceCount)
PlayersConnected
Game.PlayersConnected: int
Returns the number of players connected to the game.
Example
print(game.PlayersConnected)
Events
Rendered
Game.Rendered(deltaTime: float)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
deltaTime | float | - |
Fires every frame after the place has been rendered. The deltaTime parameter is the time between the last frame and the current.
The server is incapable of rendering frames; rather, on server Scripts, the event will fire at the server's tick rate, which may vary between 1-30Hz.
It is recommended to only listen to this event on LocalScripts.