Sungmingamerpro13

WinManager

Feb 7th, 2026
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.52 KB | None | 0 0
  1. local DataStoreService = game:GetService("DataStoreService")
  2. local WinsStore = DataStoreService:GetOrderedDataStore("GlobalLeaderboardWins")
  3.  
  4. local WinManager = {}
  5.  
  6. function WinManager.AwardWin(player)
  7.     local userId = player.UserId
  8.     if not userId then return end
  9.  
  10.     -- Add +1 to their wins
  11.     local success, err = pcall(function()
  12.         local current = WinsStore:GetAsync(userId) or 0
  13.         WinsStore:SetAsync(userId, current + 1)
  14.     end)
  15.  
  16.     if not success then
  17.         warn("Failed to award win:", err)
  18.     end
  19. end
  20.  
  21. return WinManager
Add Comment
Please, Sign In to add comment