I want to make a player data StringValue with the .Value formatted with JSON
This LocalScript in StarterPlayerScripts throws error “Can’t parse JSON”:
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LocalPlayer = Players.LocalPlayer
wait(5)
local playerDataFolder = ReplicatedStorage:WaitForChild("PlayerData")
local coinDisplay = LocalPlayer.PlayerGui:WaitForChild("Main"):WaitForChild("CoinDisplay")
while true do
local playerData = playerDataFolder:FindFirstChild("Data_"..tostring(LocalPlayer.UserId))
local decodedData = HttpService:JSONDecode(playerData)
coinDisplay.TextLabel.Text = tostring(decodedData.Coins)
wait(0.1)
end
And the JSON is {"Coins":50,"Level":0,"Wins":0,"XpAmount":0}
(100% VALID JSON)
I have tried looking this from Roblox Developer Hub.