Appearance
Server Interface Types ​
PlayerStateServer ​
The enhanced server module interface with all available functions.
lua
export type PlayerStateServer = {
Init: (player: Player, existingData: PlayerData?) -> boolean,
SaveData: (player: Player) -> boolean,
Set: (player: Player, key: string, value: any) -> boolean,
Get: (player: Player, key: string) -> any,
SetPath: (player: Player, path: ValuePath, value: any) -> boolean,
GetPath: (player: Player, path: ValuePath) -> any,
OnChanged: (player: Player, pathOrKey: string, callback: ChangeCallback) -> ReplicaConnection?,
SetValues: (player: Player, values: {[string]: any}) -> boolean,
BatchSetValues: (player: Player, operations: {BatchOperation}) -> boolean,
BatchUpdateValues: (player: Player, operations: {BatchUpdateOperation}) -> boolean,
FlushBatch: (player: Player) -> boolean,
Increment: (player: Player, path: ValuePath, amount: number?) -> boolean,
Decrement: (player: Player, path: ValuePath, amount: number?) -> boolean,
AddToArray: (player: Player, arrayPath: ArrayPath, item: any) -> boolean,
RemoveFromArray: (player: Player, arrayPath: ArrayPath, index: number) -> boolean,
UpdateArrayItem: (player: Player, arrayPath: ArrayPath, index: number, newItem: any) -> boolean,
SetInDict: (player: Player, dictPath: DictPath, key: string | number, value: any) -> boolean,
GetFromDict: (player: Player, dictPath: DictPath, key: string | number) -> any,
RemoveFromDict: (player: Player, dictPath: DictPath, key: string | number) -> boolean,
Clone: (value: any, deep: boolean?) -> any,
ClearPathCache: () -> (),
GetReplica: (player: Player) -> ReplicaInstance?,
GetProfile: (player: Player) -> ProfileStoreProfile?,
GetAll: (player: Player) -> PlayerData?,
GetOfflineData: (userId: number) -> PlayerData?,
IsPlayerDataReady: (player: Player) -> boolean,
SetOfflineData: (userId: number, path: string, value: any) -> boolean,
WipePlayerData: (player: Player) -> boolean,
WipeOfflinePlayerData: (userId: number) -> boolean,
UpdateLeaderboard: (player: Player, statName: string, score: number) -> boolean,
GetLeaderboard: (statName: string, topCount: number) -> {LeaderboardEntry},
GetPlayerRank: (player: Player, statName: string) -> number?,
SetShared: (key: string, value: any) -> boolean,
GetShared: (key: string) -> any,
SetSharedPath: (path: ValuePath, value: any) -> boolean,
GetSharedPath: (path: ValuePath) -> any,
SetSharedValues: (values: {[string]: any}) -> boolean,
OnSharedChanged: (pathOrKey: string, callback: ChangeCallback) -> ReplicaConnection?,
GetSharedReplica: () -> ReplicaInstance?,
GetSharedAll: () -> {[string]: any}?,
IsSharedReady: () -> boolean,
}Also exposes BeforeSave, ProfileLoaded, ProfileUnloaded, and MigrationResult signals — see Server Events.
ProfileStoreProfile ​
Enhanced ProfileStore profile interface for data persistence.
lua
export type ProfileStoreProfile = {
Data: PlayerData,
OnSessionEnd: RBXScriptSignal,
AddUserId: (self: ProfileStoreProfile, userId: number) -> (),
Reconcile: (self: ProfileStoreProfile) -> (),
EndSession: (self: ProfileStoreProfile) -> (),
IsActive: (self: ProfileStoreProfile) -> boolean,
MessageHandler: (self: ProfileStoreProfile, fn: (message: any, processed: () -> ()) -> ()) -> (),
}Key Properties:
Data: The actual player dataOnSessionEnd: Event fired when profile session endsAddUserId(): Associates user ID with profileReconcile(): Merges template changes with existing dataEndSession(): Manually end the profile sessionIsActive(): Check if profile is still active
Notes:
- NEW: Enhanced validation for active status
- NEW: Better session management
- NEW: Automatic cleanup on session end