Skip to content

Commit d4fba9e

Browse files
author
Shepp04
committed
fixed onProfileLoad logic in DataManager: profile.Info should be initialised before ReconcileAllSections is called
1 parent 0824518 commit d4fba9e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/server/packages/DataManager.luau

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ end
6464

6565
-- Initializes a player profile when loaded
6666
local 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 })
8989
end
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
182185
end
183186

0 commit comments

Comments
 (0)