DataModel
DataModel : ServiceProvider
Overview
As the top-level hierarchical element structuring the entire game, it encompasses various core services.
Essential game elements like Workspace and Lighting are children of the DataModel, accessible globally via game, which is a global object.
Properties
Methods
EnableJoin
Allows players to join a game session. Calling this method enables players to connect to the server and participate. This API can only be called on the server.
Parameters
Return
void
Code Samples
-- Allow server entry
game:EnableJoin() -- Server state: true
DisableJoin
Prevents new players from joining the game session. This API can only be called on the server.
Parameters
Return
void
Code Samples
-- Block server entry
game:DisableJoin() -- Server state: false
IsJoinEnabled
Checks whether the current game session allows players to join. Returns true if joining is allowed, otherwise false.
Parameters
Return
bool
Specifies whether joining is allowed for the current session.
Code Samples
-- During test execution, toggle the allow player join state and output logs
-- Check initial server state
print("Initial join enabled state : ", game:IsJoinEnabled())
-- Block server entry
game:DisableJoin()
print("Join Disabled. Current State : ", game:IsJoinEnabled())
task.wait(5)
-- Allow server entry
game:EnableJoin()
print("Join Enabled. Current State : ", game:IsJoinEnabled())
Events
Last updated