DataStore:UpdateAsync(key1, function(playerTable)
playerTable = playerTable or {} --oldValue might be nil
local playerTableSize = #playerTable
print("Player table's size is: " .. playerTableSize)
if playerTableSize < 1 then -- Should be set to 0. Player should have a rock when they first join the game as a new player
playerTable = {{"Chair", 1, "rbxassetid://12253236082"}, {"Wooden Table", 3, "rbxassetid://480030630"}}
end
return playerTable
end)
But it just gives me the error: HTTP 404 (Not Found) for the line. That never happened to me before using this years back. Is the code here outdated? Thanks.
Idk, but this exact code worked 2 years ago… Is it just outdated? Thanks. It’s supposed to update the datastore even if there is nothing there, it just makes one.
EDIT: Now I got this: 502: API Services rejected request with error. HTTP 403 (Forbidden)
I did. There is a white checkmark box after “Enable Studio access to API services”. Thanks.
EDIT: Wait, I made a mistake. I had two test places and I wrote the code for the datastore in the one that I was using only for GUI making. My bad everyone, thanks for the help anyway.