So I'm making a datastore for a table, which codes and decodes JSON. I'm pretty sure I messed up in this, but the strange thing is, i get this error: https://gyazo.com/b891b41d049db1837b9d2db13c9d0d92 (line 9), but line 9 in my script is just a simple end). Here is my script:
local purchasedfolder = game.Workspace.PurchasedValues
local HttpService = game:GetService("HttpService")
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("TableStore")
game.Players.PlayerAdded:Connect(function(player)
local key = player.Name.."-"..player.UserId
local stringData = DataStore:GetAsync(key)
local data = HttpService:JSONDecode(stringData)
end)
game.Players.PlayerRemoving:Connect(function(player)
local data = { values =
purchasedfolder.Purchasedbmw,
purchasedfolder.Purchasedgtr,
purchasedfolder.Purchasedhoon,
purchasedfolder.Purchasedmc,
purchasedfolder.Purchasedpor,
purchasedfolder.Purchaseds13
}
local key = player.Name.."-"..player.UserId
local stringData = HttpService:JSONEncode(data)
DataStore:SetAsync(key, stringData)
end)
I hope somebody helps me to fix this problem.

1 comment
I'm stupid. I accidentally cloned the script and there were 2 scripts and the other had an error on it, my bad.