I have a Points Leaderboard in our Cafe Game. It works fine. But when someone leaves and rejoins the Same server their Points get blanked. If they join another server it doesn't happen. Here is the script of when they leave -
game.Players.PlayerRemoving:connect(function(player)
if array[player.Name] ~= nil then
game:GetService("DataStoreService"):GetDataStore("Points"):UpdateAsync("user_"..player.userId, function(oldValue)
local newValue = array[player.Name]
return newValue
end)
array[player.Name] = nil
end
end)

5 comments
You should use SetAsync instead of UpdateAsync
Ok let me try,
Nope still doesn't work.
Is it because I am setting array to nil?
Whats in the PlayerAdded event?