Question about long numbers for currency purchase

Hello, so I am making a simulator game and was curious about something. When I’m making my currency shop gui am I going to have to write all the 0’s for the coin purchase or is there an easier way to do it?

-- Variables -- 
local MPS = game:GetService("MarketplaceService")

-- Purchase -- 
local coinsProductIDs = 
	{
		[1150214074] = 30 Novemdecillion ,
		[0] = 175.500 Novemdecillion ,
		[0] = 699.750 Novemdecillion ,
		[0] = 2.000 Vigintillion,
	}



MPS.ProcessReceipt = function(purchaseInfo)


	local plrPurchased = game.Players:GetPlayerByUserId(purchaseInfo.PlayerId)

	if not plrPurchased then

		return Enum.ProductPurchaseDecision.NotProcessedYet
	end


	for productID, coinsGiven in pairs(coinsProductIDs) do

		if purchaseInfo.ProductId == productID then


			plrPurchased.leaderstats.Coins.Value = plrPurchased.leaderstats.Coins.Value + coinsGiven

			return Enum.ProductPurchaseDecision.PurchaseGranted
		end
	end
end```

do it the same way you display the amount of coins they currently have.

Use scientific or exponential notation to represent your numbers. I recommend the former because it’s easier to read but if you understand the principle you can use the latter.

Using Novemdecillion as a point of reference since its your lowest costing product, a quick Google search shows that Novemdecillion is 10^60, so just multiply by this value. 2 * (10^60) is 2 Novemdecillion. The number will be represented in exponential notation as 2e+60, where e+ is a shorthand representing exponentiation by base 10 to the power of the preceding number.

If you want the whole number and no use of any notation, find a BigNum library to help you with handling large numbers.

Here’s how your code would look with either scientific or exponential notation using 30 Novemdecillion as a point of reference since it’s your first entry:

-- As scientific
[1150214074] = (30 * (10^60)),

-- As exponential
[1150214074] = 30e+60,

Im sure that works, but for me when I try to purchase it, it brings my coins back down to 0 instead of it going up… here is my leaderstat code

-- variables --
local DataStore = game:GetService("DataStoreService"):GetDataStore("DataStore")
local MPS = game:GetService("MarketplaceService")

-- leaderstats --
game.Players.PlayerAdded:Connect(function(Player)
	local Leaderstats = Instance.new("Folder")
	Leaderstats.Name = "leaderstats"
	Leaderstats.Parent = Player

	local Coins = Instance.new("IntValue")
	Coins.Name = "Coins"
	Coins.Parent = Leaderstats

	local Strength = Instance.new("IntValue")
	Strength.Name = "Strength"
	Strength.Parent = Leaderstats
	
	local Rebirths = Instance.new("IntValue")
	Rebirths.Name = "Water"
	Rebirths.Parent = Leaderstats

	local CoinsData
	local StrengthData
	local RebirthsData

	local Success, ErrorMessage = pcall(function()
		CoinsData = DataStore:GetAsync(Player.UserId.."-CashData")
		StrengthData = DataStore:GetAsync(Player.UserId.."-PointsData")
		RebirthsData = DataStore:GetAsync(Player.UserId.."-RebirthsData")
	end)

	if not Success then
		print(ErrorMessage)
	end

	if CoinsData ~= nil then
		Coins.Value = CoinsData
	else
		Coins.Value = 0
	end

	if StrengthData ~= nil then
		Strength.Value = StrengthData
	else
		Strength.Value = 0
	end
	
	if RebirthsData ~= nil then
		Strength.Value = RebirthsData
	else
		Strength.Value = 0
	end
end)

game.Players.PlayerRemoving:Connect(function(Player)
	pcall(function()
		DataStore:SetAsync(Player.UserId.."-CashData", Player.leaderstats.Coins.Value)
		DataStore:SetAsync(Player.UserId.."-PointsData", Player.leaderstats.Strength.Value)
		DataStore:SetAsync(Player.UserId.."-RebirthsData", Player.leaderstats.Rebirths.Value)
	end)
end)



-- Purchase -- 
local coinsProductIDs = 
	{
		[1150214074] = (30 * (10^60)),
		[1096715119] = 500,
		[1096715447] = 1000,
		[1096715703] = 5000,
	}



MPS.ProcessReceipt = function(purchaseInfo)


	local plrPurchased = game.Players:GetPlayerByUserId(purchaseInfo.PlayerId)

	if not plrPurchased then

		return Enum.ProductPurchaseDecision.NotProcessedYet
	end


	for productID, coinsGiven in pairs(coinsProductIDs) do

		if purchaseInfo.ProductId == productID then


			plrPurchased.leaderstats.Coins.Value = plrPurchased.leaderstats.Coins.Value + coinsGiven

			return Enum.ProductPurchaseDecision.PurchaseGranted
		end
	end
end

Here is also the display script for the text label but I don’t think that would affect the leaderstats

local abbrev = {"","K","M","B", "t", "q", "Q", "s", "S", "o", "n", "d", "U", "D", "T", "Qt", "Qd", "Sd", "St", "O", "N", "v", "c"}

local function Format(value, idp)
	local ex = math.floor(math.log(math.max(1, math.abs(value)), 1000))
	local abbrevs = abbrev[1 + ex] or ("e+"..ex)
	local normal = math.floor(value * ((10 ^ idp) / (1000 ^ ex))) / (10 ^ idp)
	
	return ("%."..idp.."f%s"):format(normal, abbrevs)
end

while wait() do
	local player = game.Players.LocalPlayer
	script.Parent.Text = Format(player.leaderstats.Coins.Value,2)
end```

It’s because you’re using an IntValue which uses a signed 64-bit integer as its value. The maximum signed 64-bit integer value is 9,223,372,036,854,775,807 or 2^63-1 and your number exceeds this. Use a NumberValue instead.

Thank you so much for your help!