Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DataStoreService = game:GetService("DataStoreService")
- local WinsStore = DataStoreService:GetOrderedDataStore("GlobalLeaderboardWins")
- local WinManager = {}
- function WinManager.AwardWin(player)
- local userId = player.UserId
- if not userId then return end
- -- Add +1 to their wins
- local success, err = pcall(function()
- local current = WinsStore:GetAsync(userId) or 0
- WinsStore:SetAsync(userId, current + 1)
- end)
- if not success then
- warn("Failed to award win:", err)
- end
- end
- return WinManager
Add Comment
Please, Sign In to add comment