Why isnt this script that uses GoogleSpreadsheet SAVING my value?
It posts the player's id and the value in the right place, but when the player leaves, it does not update the value in the spreadsheet. Why?
Also I have problems on line 14, where I need to get the value in the spreadsheet and insert it into the player's leaderstats.
databaseService = require(game.Workspace.DatabaseService) --//Gets the Database - module script
game.Players.PlayerAdded:connect(function(player)
local id = player.UserId --//Gets the player's UserId
local Brickcoins = player:WaitForChild("leaderstats"):WaitForChild("Brickcoins") --//The player's BrickCoins
local globalDatabase = databaseService:GetDatabase("Global")
if not globalDatabase:GetAsync("player-"..id) then --//if the player has not yet any data stored
globalDatabase:PostAsync("player-"..id , Brickcoins.Value) --//Posts another "data" to the spreadsheet named for instance: "player-123456"
print(globalDatabase:GetAsync("CoolPeople")) --//Prints the name of all the cool people stored in the database
Brickcoins.Value = 0
else --//And if the player has data stored, then
Brickcoins.Value = globalDatabase:GetAsync() --//This is where I would need to get the player's saved value, but I have problems with figuring out how.
--//Have to get the BrickCoins value the player has previously stored
end
end)
game.Players.PlayerRemoved:connect(function(player)
local id = player.UserId --//Gets the player's UserId
local Brickcoins = player:WaitForChild("leaderstats"):WaitForChild("Brickcoins") --//The player's BrickCoins
local globalDatabase = databaseService:GetDatabase("Global")
globalDatabase:PostAsync("player-"..id , Brickcoins.Value) --Posts the player's name(currently) going to post the BrickCoins' value
--//Have to update the BrickCoins - value the player has
end)
Any help is greatly appreciated!

5 comments
Are there any errors in the output after the player leaves? Have you tested to make sure the PostAsync call actually finishes?
Wouldn't providing GetAsync at line 14 with
"player-" .. idachieve the desired effect?There are no errors after the player leaves, @BlueTaslem. And how would I check the PostAsync call actually finishes?
you should probably store the info as a JSON, just my personal thought
If you're posting to Google Spreadsheets, your API endpoint is probably misconfigured. Make sure your API keys and authentication are working.