Hello! I’m encountering this problem;
This DataStore is not saving for some reason. I’m setting my Data through Developer Console, don’t worry about that.
Here is the PlayerRemoving Code:
players.PlayerRemoving:Connect(function(plr)
print("Player Removing...")
--Save his data
local realStats = plr:WaitForChild("RealStats")
local realMultiplayers = plr:WaitForChild("realMultiplayers")
local realLeaderstats = plr:WaitForChild("realLeaderstats")
local RealCounts = plr:WaitForChild("RealCounts")
local tableToSave = {
Strength = realStats:WaitForChild("Strength").Value,
Endurance = realStats:WaitForChild("Endurance").Value,
Psychic = realStats:WaitForChild("Psychic").Value,
Agility = realStats:WaitForChild("Agility").Value,
Swiftness = realStats:WaitForChild("Swiftness").Value,
StrengthMultiplayer = realMultiplayers:WaitForChild("StrengthMultiplayer").Value,
EnduranceMultiplayer = realMultiplayers:WaitForChild("EnduranceMultiplayer").Value,
PsychicMultiplayer = realMultiplayers:WaitForChild("PsychicMultiplayer").Value,
AgilityMultiplayer = realMultiplayers:WaitForChild("AgilityMultiplayer").Value,
SwiftnessMultiplayer = realMultiplayers:WaitForChild("SwiftnessMultiplayer").Value,
Killstreak = realLeaderstats:WaitForChild("Killstreak").Value,
Reputation = RealCounts:WaitForChild("Reputation").Value,
ClassCounts = RealCounts:WaitForChild("ClassCounts").Value
}
print(tableToSave.Killstreak)
local success, errormessage = pcall(function()
print("Pcall")
StatsDataStore:UpdateAsync(plr.UserId, function()
return tableToSave
end)
end)
if errormessage then
print(errormessage)
StatsDataStore:UpdateAsync(plr.UserId, function()
return tableToSave
end)
end
if success then
print(success)
end
end)
Here is the PlayerAdded Code:
local Async = StatsDataStore:GetAsync(player.UserId)
if Async then
--He has an Async
local StrengthValue = Async.Strength
local EnduranceValue = Async.Endurance
local PsychicValue = Async.Psychic
local AgilityValue = Async.Agility
local SwiftnessValue = Async.Swiftness
local StrengthMultiplayerValue = Async.StrengthMultiplayer
local EnduranceMultiplayerValue = Async.EnduranceMultiplayer
local PsychicMultiplayerValue = Async.PsychicMultiplayer
local AgilityMultiplayerValue = Async.AgilityMultiplayer
local SwiftnessMultiplayerValue = Async.SwiftnessMultiplayer
local KillstreakValue = Async.Killstreak
local ReputationValue = Async.Reputation
local ClassCountsValue = Async.ClassCounts
print(Async.Killstreak)
Strength.Value = StrengthValue
Endurance.Value = EnduranceValue
Psychic.Value = PsychicValue
Agility.Value = AgilityValue
Swiftness.Value = SwiftnessValue
StrengthMultiplayer.Value = StrengthMultiplayerValue
EnduranceMultiplayer.Value = EnduranceMultiplayerValue
PsychicMultiplayer.Value = PsychicMultiplayerValue
AgilityMultiplayer.Value = AgilityMultiplayerValue
Killstreak.Value = KillstreakValue
Reputation.Value = ReputationValue
ClassCounts.Value = ClassCountsValue
end
Everything prints and works fine, just that it doesn’t save.
I set my Killstreak value to 500, and after that it printed 20 after getting it.
Can you see anything wrong with this?