103: double is not allowed in data stores

Greetings! I am working on a world record system, and I got this error:
image
The number it is trying to set is 103.245643664. I don’t see how the is not allowed.

ReplicatedStorage.WorldRecord.SetWorldRecord:Fire(Player, TimeTrialsValue)
ReplicatedStorage.WorldRecord.SetWorldRecord.Event:Connect(function(Player, Time)
	WorldRecords:SetAsync(Player.UserId, Time)
end)

And TimeTrialsValue is a stopwatch NumberValue.Value.

Is there any way at all to get decimals in a DataStore, or should I halt this idea?

The only thing i can think to is to save it as a string and then convert it to number

The only solution I’ve got here is to pack it into a string encoded double using string.pack then save those bytes as a base64 string

Probably too technical for this though

I’m guessing your using a ordered datastore because your allowed doubles in normal datastore

What you can do is

local value = 103.245643664

value = math.round(value * 1000)

-- now save value to datastore


-- and once you load the value from datastore

value /= 1000

print(value) -- 103.245

Instead of 1000 you can use larger values like 10000 or 100000 to save more decimals

1 Like