Any way to use BigInteger for an IntValue?

Hi!
My question is in the title.
Basically I want to make an IntValue that can be bigger than 9223372036854775807.
Is there any way to do that? I tried using BigInteger but it seems to not work for IntValues, only for variables.

Here is what I tried

local Players = game:GetService("Players")
local bigInteger = require(game:GetService("ReplicatedStorage"):WaitForChild("BigIntegerStandalone"))

Players.PlayerAdded:Connect(function(plr)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = plr

	local IntValue1 = Instance.new("StringValue")
	IntValue1.Value = bigInteger.new(9999999999999999999999999999999) --0
	IntValue1.Name = "Cash"
	IntValue1.Parent = leaderstats
end)

I suggest using string values; and changing it to the following:
if it’s 1 000 it becomes 1k
if it’s 1 000 000 it becomes 1M
etc

2 Likes

I have an abbreviation system already

Someone told me to use NumberValues so I’m gonna try that.

No, there is no way to do this. An IntValue stores a 64 bit integer, and the value of a bigint exceeds the capacity. Generally you can instantiate BigInt types with a string, so if you are simply trying to store it, store it in a StringValue and put it back into a BigInt when you need to operate on it.

1 Like

store the number value inside the script; not outside and or store it in DataStores.

1 Like

What would you say about NumberValues? Are they bad because it’s just an estimate?
Some people told me that when they tried setting their NumberValue to 0.3 it became 0.2999999999

NumberValues are doubles. They aren’t an estimate per se, but there are things called floating point errors. This is caused by precision issues, take a look at this for more detail. To avoid this you could use string formatting and such.

1 Like

Alright, using StringValues should be easier than all that, then, I guess.

Every time you would use a StringValue and you want to set it to a value you’d need to do,

StringValue.Value = tonumber(StringValue.Value) + 10
1 Like

use number values to store the number, but 10x smaller than it actually is, and just *10 and abbreviate it when it needs to be displayed

1 Like

I just used number values, seems to be working fine as this game is working with higher numbers, not decimals

1 Like