Hello, I am trying to make a system that saves various values. I thought of doing that by combining all values in a JSON string, and tried that. The problem was that the JSON kept giving me null.
A bit of context, the player has a folder in it named "Stats". That folder has another folder in it called Coins. Inside of coins are a bunch of "accroutements" that all have a different name.
local httpservice = game:GetService("HttpService") game.Players.PlayerRemoving:Connect(function(player) local stats = player.Stats local CollectedCoins = {} for i,v in pairs(stats.Coins:GetChildren()) do table.insert(CollectedCoins, v.Name) end local JSON = httpservice:JSONEncode(CollectedCoins) print(JSON) end)
My problem is that this keeps giving me null or "[]" in the output, and I have no idea why. the JSON string also includes other tables that work pretty much the same as the CollectedCoins one. Does anyone know why this is and how to solve it?
Thanks for your time.
Almost forgot to mention, this is a ServerScript located in ServerScriptService