Json Code:
{
"TotalDonation" : 0,
"RecentDonator" : []
}
Hello Developers!
im confused on what’s wrong with my script. In here, I’m decoding the string json but instead of this
it did it like this
. the
TotalDonation
and the RecentDonator
doesn’t exist or nil.
Check the count of table:
Output: 0 (Expected = 2)
Script Error:
Line script:
Value from:
Table from
JSON Format
raw
local function updateRecent()
if _GData:GetAsync(game.GameId..'--key') then
print(tostring(_GData:GetAsync(game.GameId..'--key')))
local LUAU_Data = HttpService:JSONDecode(tostring(_GData:GetAsync(game.GameId..'--key')))
warn(#LUAU_Data)
print(LUAU_Data)
for _, players in pairs(game.Players:GetPlayers()) do
for index, value in pairs(LUAU_Data) do
local __D = game:GetService('ReplicatedStorage').DonatorTemplate:Clone()
__D.Parent = players:WaitForChild('PlayerGui'):WaitForChild('ScreenGui').Frame.Leaderstats.RecentDonator
__D.Raised.Text = value
__D.Username.Text = index
end
end
end
end
if my explanation is not quite accurate, you can ask me so you could further look for more details. (i feel like that my explanation is bad that’s why i put this here)