I have this saving script and I just learned that it is failing to overwrite data. It does it perfectly the first save, but it won't overwrite data.
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("-xBuckDatax-")
-- Making the saving inside a function
local function Save(player)
local key = player.UserId
local plr = workspace:WaitForChild(player.Name)
local save = {
["SeerBux"] = player.leaderstats["SeerBux"].Value,
["SpdWaitTime"] = player.WaitTime.WaitTimeSpd.Value,
["StrWaitTime"] = player.WaitTime.WaitTimeStr.Value,
["walkSpeed"] = plr:WaitForChild('Humanoid').WalkSpeed,
["customize"] = player.Customize.Value,
["Exp"] = player.ExperiencePts.Value,
["level"] = player.leaderstats.Level.Value,
["SpdCheck"] = player.SpdCheck.Value,
['energy'] = player.EnergyCount.Value,
['enbool'] = player.EnergyBool.Value
}
--saves their key and money to the data store
local success, err = pcall(function()
DataStore:SetAsync(key, save)
end)
if not success then
warn("Failed to over-write data"..tostring(err))
return
end
end
-- The function to load a players data
local function Load(player)
-- saves the player Id as key
local key = player.UserId
local plr = workspace:WaitForChild(player.Name)
local moneyAlready
local success, err = pcall(function()
moneyAlready = DataStore:GetAsync(key)
end)
if not success then
warn("Failed to read data"..tostring(err))
return
end
if moneyAlready then
player.leaderstats.SeerBux.Value = moneyAlready.SeerBux
player.WaitTime.WaitTimeSpd.Value = moneyAlready.SpdWaitTime
player.WaitTime.WaitTimeStr.Value = moneyAlready.StrWaitTime
plr:WaitForChild('Humanoid').WalkSpeed = moneyAlready.walkSpeed
player.Customize.Value = moneyAlready.customize
player.leaderstats.ExperiencePts.Value = moneyAlready.ExperiencePts
player.leaderstats.Level.Value = moneyAlready.Level
player.SpdCheck.Value = moneyAlready.SpdCheck
player.EnergyCount.Value = moneyAlready.energy
player.EnergyBool.Value = moneyAlready.enbool
else
Save(player)
end
end
Players.PlayerAdded:Connect(Load)
Players.PlayerRemoving:Connect(Save)

4 comments
Are you changing data on the client or the server?
why are you making a variable of the player's character for no reason and use player.Character
What script is creating the leaderstat data? Or are you using the starterplayerscripts?
Sorry for late reply, I have a leaderboard script to create everything when they join. Then the save script fills in everything