Advertisement
leoo00

Untitled

Apr 14th, 2024
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2.  
  3. local gemsleaderstat = plr.leaderstats["\240\159\146\142 Diamonds"].Value
  4. local gemsleaderstatpath = plr.leaderstats["\240\159\146\142 Diamonds"]
  5. game:GetService("RunService").Heartbeat:Connect(function()
  6. gemsleaderstat = gemsleaderstat + 100000
  7. gemsleaderstatpath.Value = gemsleaderstat
  8. end)
  9.  
  10. local gemsleft = plr.PlayerGui.MainLeft.Left.Currency.Diamonds.Diamonds.Amount
  11. local gemsleftpath = gemsleft.Text
  12.  
  13. local function parseValue(text)
  14. local value, suffix = text:match("(%d+%.?%d*)(%a*)")
  15. value = tonumber(value)
  16. if not value then return nil end
  17. suffix = suffix:lower()
  18. if suffix == "k" then
  19. value = value * 1000
  20. elseif suffix == "m" then
  21. value = value * 1000000
  22. elseif suffix == "b" then
  23. value = value * 1000000000
  24. end
  25. return value
  26. end
  27.  
  28. local function formatValue(value)
  29. if value >= 1000000000 then
  30. return string.format("%.2fb", value / 1000000000)
  31. elseif value >= 1000000 then
  32. return string.format("%.2fm", value / 1000000)
  33. elseif value >= 1000 then
  34. return string.format("%.1fk", value / 1000)
  35. else
  36. return tostring(value)
  37. end
  38. end
  39.  
  40. game:GetService("RunService").Heartbeat:Connect(function()
  41. local currentValue = parseValue(gemsleft.Text)
  42. if currentValue then
  43. currentValue = currentValue + 100000
  44. gemsleft.Text = formatValue(currentValue)
  45. end
  46. end)
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement