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)
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.
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.