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
Enables player joining for the game session. Once invoked, players are allowed to connect and join the server. This API can only be called from the server.
Parameters
Return
void
Code Samples
-- Enable Server Join
game:EnableJoin() -- Server State : true
DisableJoin
Prevents new players from joining the game session. This API can only be called from the server.
Parameters
Return
void
Code Samples
-- Disable Server Join
game:DisableJoin() -- Server State : false
IsJoinEnabled
Checks whether the current game session allows players to join. Returns true if joining is enabled, and false otherwise.
Parameters
Return
bool
Code Samples
-- Toggle join permission state and print logs at each step
-- Check Initial Server State
print("Initial join enabled state : ", game:IsJoinEnabled())
-- Disable Server Join
game:DisableJoin()
print("Join Disabled. Current State : ", game:IsJoinEnabled())
task.wait(5)
-- Enable Server Join
game:EnableJoin()
print("Join Enabled. Current State : ", game:IsJoinEnabled())
Events
Last updated