Double is not allowed in data stores?

Im trying to make a global leaderbaord, but it is saying that double is not allowed in data stores?
Line 24

tlocal ds = game:GetService("DataStoreService")

local KillsODS = ds:GetOrderedDataStore("KillsStats")


local timeUntilReset = 10


while wait(1) do
	
	
	timeUntilReset = timeUntilReset - 1
	
	script.Parent.Parent.ResetTime.Text = "Resetting in " .. timeUntilReset .. " seconds..."
	
	
	if timeUntilReset == 0 then
		
		timeUntilReset = 10
	
	
		for i, plr in pairs(game.Players:GetPlayers()) do
			
			KillsODS:SetAsync(plr.UserId, plr.leaderstats.Cash.Value)
		end
		
		for i, leaderboardRank in pairs(script.Parent:GetChildren()) do
			
			if leaderboardRank.ClassName == "Frame" then
				leaderboardRank:Destroy()
			end
		end
		
		
		local success, errorMsg = pcall(function()
			
			local data = KillsODS:GetSortedAsync(false, 50)
			local KillsPage = data:GetCurrentPage()
			
			for rankInLB, dataStored in ipairs(KillsPage) do
				
				
				local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))
				local Cash = dataStored.value
				
				
				local template = script.Template:Clone()
				
				template.Name = name .. "Leaderboard"
				
				template.PlrName.Text = name
				
				template.Rank.Text = "#" .. rankInLB
				
				template.Kills.Text = Cash
				
				template.Parent = script.Parent				
			end			
		end)
	end
end


1 Like

While this is not entirely accurate by definition, you can think of a double as a number with a decimal. The following are examples of doubles:

  • 5.6
  • 3.0
  • 0.02

These are not allowed in OrderedDataStores. Only integers (whole numbers, but including negative whole numbers) are the only values allowed in OrderedDataStores. Here are some examples of integers:

  • 1
  • 0
  • -256

I suggest you round your cash values to the nearest whole number before you save them.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.