Data Store doesn't Save

Data store for Elo doesn’t work at all Even though It has the exact same code as the win data store except wins are replaced with Elo.

local dss = game:GetService("DataStoreService")
local DefualtElo = 1000
local ELO = Instance.new("IntValue")
ELO.Name = "Elo"
ELO.Value = 1000
ELO.Parent = leaderstats
local ELoData
pcall(function() ELoData = dataStores:GetAsync(player.UserId.."-Elo")
end)

if ELoData ~=nil then Note I do think that It is this line I have tried something like -- If ELoData ~=defaultElo then But that didn’t really work.
ELO.Value = ELoData
end

--New player
Cash.Value = defaultCash
wins.Value = defualtWins
ELO.Value = DefualtElo

``pcall(function()``
	``dataStores:SetAsync(player.UserId.."-Elo",player.leaderstats.ELO.Value)``
``end)``

Note there are no errors.

Can you show me the player removing data script?

game.Players.PlayerRemoving:Connect(function(player)
pcall(function()
dataStores:SetAsync(player.UserId.."-Elo",player.leaderstats.ELO.Value)
end)
end
end)
end)

Are you using the same key for this data store as the coins data store?

local bindableEvent = Instance.new("BindableEvent")

print("Saved!")
playersLeft = playersLeft - 1
bindableEvent:Fire()

Inside the bindableEvent there is all the code like player removing and saving.

You shouldn’t be using bindable events for saving data once the player leaves, it very insufficient. Most of the time it won’t be able to get the data. You should use a functions To save your data.

local function data(plr)

end

oooooooohhh. Let me try that then.

seems to me you’re setting the elo to default even after setting the value of elo to loaded elo

the elo should be in the else

if ELoData ~= nil then
ELO.Value = ELoData
else
ELO.Value = DefaultElo
end

Yeah I All ready have that line. The Else Part I just didn’t put it on the explination.

It didn’t work, It just broke then entire saving system.

I just didn’t save anything even the wins and cash It just broke all of it.

I found what went wrong and it was the fact that I had Elo In all caps, but in the leaderstats it was Elo not in all caps.