6464
6565-- Initializes a player profile when loaded
6666local function onProfileLoad (player : Player , profile : Types .PlayerProfile )
67- -- Reconcile all sections into data
68- DataManager :ReconcileAllSections (player , profile )
69-
7067 -- Initialise Info
7168 profile .Info = deepClone (INFO_TEMPLATE )
7269
70+ -- Reconcile all sections into data
71+ DataManager :ReconcileAllSections (player , profile )
72+
7373 -- Extra temporary values
7474 local now = os.time ()
7575 profile .Info .JoinTime = now
@@ -83,9 +83,9 @@ local function onProfileLoad(player: Player, profile: Types.PlayerProfile)
8383 -- Save join time locally for playtime calc
8484 profile .Info .JoinTime = os.time ()
8585
86+ -- Replicate main data sections (reconciled sections are also replicated)
8687 ReplicatedData :SetData ("PlayerData" , profile .Data , { player })
8788 ReplicatedData :SetData ("PlayerInfo" , profile .Info , { player })
88- ReplicatedData :SetData ("Stats" , profile .Data .Stats , { player })
8989end
9090
9191--[[
@@ -178,6 +178,9 @@ function DataManager:ReconcileProfileSection(player: Player, profile: Types.Play
178178 ReplicatedData :SetData ("PlayerData" , profile .Data , { player })
179179 end
180180
181+ -- Replicate this section to the client
182+ ReplicatedData :SetData (sectionName , template , { player })
183+
181184 return true
182185end
183186
0 commit comments