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