I’m currently trying to save individual cooldowns (simply a stored int value, os.clock), which are all cloned from ReplicatedStorage into a folder into the player on join. They start off as ‘0’ by default, and when the player finishes a level, the corresponding cooldown is updated as the current os.clock. When the player leaves and rejoins, after the values are cloned, the datastore should update them with their saved values.
So! That value is saved successfully, actually. The value is reflected in the player’s save data folder, and my datastore prints out all the saved data on PlayerRemoving, with the accurate values.
On rejoin, it also prints the loaded saved data, and it still shows the cooldown value it saved. However, when checking the player folder, the value is back at ‘0’, which directly contradicts what the save script says was loaded.

The cooldown value within the player upon finishing the level.

The saved cooldown value after the player leaves the game.

The loaded data on rejoin, reflecting the same cooldown saved before leaving

Saved cooldown does not reflect in the player.
I’m pretty sure I’m simply loading the cooldown data incorrectly, but I am really not sure.
NOTES:
- I’ve checked the value in the player on both server and client-side, still displays as ‘0’.
- There are no errors, but scripts treat the player as if there are no cooldowns active.
- All other data is saved and loaded correctly, and reflects correctly in the player. Differences being that
‘Coins’ and ‘Levels’ are not in folders, and ‘Achievements’ are loaded in a separate script. - I left out a majority of the script, as it would be too much to read through, and there are multiple
other scripts that interact with these cooldowns. But the problem definitely lies with the datastore. - ‘swag’ does not print.
local function setUp(player)
local userID = player.UserId
local key = "Player_" .. userID
-- A key is what the datastore uses to identify who to load/save data for
local pData = Instance.new("Folder")
pData.Name = "PlayerData"
-- Main player data folder
local pCooldowns = Instance.new("Folder")
pCooldowns.Name = "Cooldowns"
-- Data to be saved is created here, parented at the end
local success, returnValue
repeat
waitForRequestBudget(Enum.DataStoreRequestType.GetAsync)
success, returnValue = pcall(dataStore.GetAsync, dataStore, key)
-- Finding saved data
until success or not Players:FindFirstChild(player.Name)
if success then
-- If finding the save data was successful
print(returnValue)
if returnValue ~= nil then
for _, cooldown in pairs(pCooldowns:GetChildren()) do
cooldown.Value = returnValue["Cooldowns"] or 0
print("swag")
end
pCooldowns.Parent = pData
-- Load saved data above if found or set to their defaults
pData.Parent = player
print(returnValue)
print("Data loaded!")
end
else
print("Data Loading ERROR!!!")
end
end