Why is my OrderedDataStore giving me this error now?

My OrderedDataStore was working perfectly fine just a day ago, I haven’t touched it and now its giving me this error?

DataStoreService: ValueNotAllowed: double is not allowed in data stores. API: SetAsync, Data Store: TopMoney

Code:

for _, v in pairs(Players:GetPlayers()) do
	local Money = v:FindFirstChild('HighestMoney')
	local TotalClicks = v:FindFirstChild('Clicks')
				
	TopMoneyData:SetAsync(tostring(v.UserId), tonumber(Money.Value))
	TopClicksData:SetAsync(tostring(v.UserId), tonumber(TotalClicks.Value))
end

Money and TotalClicks are NumberValues.

1 Like

Try this?

for _, v in pairs(Players:GetPlayers()) do
	local Money = v:FindFirstChild('HighestMoney')
	local TotalClicks = v:FindFirstChild('Clicks')
				
	TopMoneyData:SetAsync(tostring(v.UserId), math.floor(Money.Value))
	TopClicksData:SetAsync(tostring(v.UserId), math.floor(TotalClicks.Value))
end
2 Likes

Oh, and I recommend wrapping the SetAsync’s in a pcall!

for _, v in pairs(Players:GetPlayers()) do
	local Money = v:FindFirstChild('HighestMoney')
	local TotalClicks = v:FindFirstChild('Clicks')
				
    local success, err = pcall(function()
        TopMoneyData:SetAsync(tostring(v.UserId), math.floor(Money.Value))
	    TopClicksData:SetAsync(tostring(v.UserId), math.floor(TotalClicks.Value))
    end
    
    if not success then warn(err) end
end
2 Likes

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