Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- in Normal Script in ServerScriptService
- local DS = game:GetService("DataStoreService"):GetDataStore("MyDataStore")
- game.Players.PlayerAdded:Connect(function(plr)
- local leaderstats = Instance.new("Folder", plr)
- leaderstats.Name = "leaderstats"
- local Coins = Instane.new("IntValue", leaderstats)
- Coins.Name = "Coins"
- Coins.Value = DS:GetAsync(plr.userId, Coins.Value) or 0
- end)
- game.Players.PlayerRemoving:Connect(function(plr)
- DS:SetAsync(plr.userId, plr.leaderstats.Coins.Value)
- end)
- -- In Module Script in TextLabel
- local module = {}
- local HighNum = {
- ['K'] = 1000,
- ['M'] = 1000000,
- ['B'] = 100000000,
- ['T'] = 10000000000,
- ['Qd'] = 1000000000000000,
- ['Qn'] = 100000000000000000,
- ['Sx'] = 100000000000000000000,
- ['Sp'] = 100000000000000000000000,
- }
- local HighestNum = 100000000000000000000000
- local HighestName = 'Sp'
- local HC = 999
- local Pattern = '%d+'
- function module.Convert(Number)
- for i,v in pairs(HighNum) do
- local Rounded = tostring(Number/v):match(Pattern)
- local RoundedNum = tonumber(Rounded)
- warn(Number)
- if Number >= v and RoundedNum and RoundedNum < 1000 and Number >= 1000 and Number < HighestNum * HC then
- local Result = Rounded..i
- warn(Result)
- return Result
- elseif Number < 1000 then
- warn(Number)
- return Number
- elseif Number > HighestNum * HC then
- warn(Number/HighestNum..HighestName)
- return Number/HighestNum..HighestName
- end
- end
- end
- return module
- -- LocalScript for getting the values in TextLabel
- local plr = game.Players.LocalPlayer
- local Coins = plr.leaderstats.Coins
- script.Parent.Text = "Coins: "..Coins.Value
- Coins:GetPropertyChangedSignal("Value"):Connect(function()
- script.Parent.Text = "Coins: "..Coins.Value
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement