Ignore this, I got it all wrong:
So currently I load in my players data using the following method:
local DataStoreService = game:GetService("DataStoreService")
local DataStoreShoeInventory = DataStoreService:GetDataStore('PlayerShoeInventory')
local Players = game:GetService('Players')
local function PlayerAdded(Player)
local Success, PlayerDataCurrentShoe = pcall(function()
return DataStoreCurrentShoe:GetAsync(tostring(UserID .. 'CurrentShoe'))
end)
if not PlayerDataShoe then
DataStoreShoeInventory:SetAsync(tostring(UserID .. 'Shoes'), '')
Player:SetAttribute('ShoeInventory', '')
else
Player:SetAttribute('ShoeInventory', PlayerDataShoe)
end
end
Players.PlayerAdded:Connect(PlayerAdded)
And I do this using multiple datastores throughout the script. However, I constantly get a problem where regardless of my pcall, it returns the text of the error and sets that into the players attribute:
And that is not even the funniest thing… You see, certain players ALWAYS have the issue where it will ALWAYS 100 PERCENT OF THE TIME return the error for the EXACT SAME DATASTORE. Ive joined the game about 50 times as Player1 and it ALWAYS returns CurrentShoe as a 502 error.
However joining as Player2, Player3, Player4, or even on my main account in a solo test as SpeedySanikJr it always returns the proper value and never errors.
Some of my players have found that this issue will always occur on a certain account, and for some reason that sole account will just always return the error instead of grabbing the data.
So what am I doing wrong here? Is it that when it grabs the data from the datastore, it just always grabs the wrong data?
Or, is it that when I set the data, it simply that I set the players Datastore as “502: API Services rejected request with error. HTTP 500 (Internal Server Error)” and now it will always return that string as the data since that is what the script accidently set it too… Yep that seems reasonable actually…
But I dont see what I am doing wrong with setting the data either?
This is how I do it, and its a similar method:
local function PlayerRemoved(Player)
if game.PrivateServerId == "" then
local UserID = Player.UserId
pcall(function()
DataStoreShoeInventory:SetAsync(tostring(UserID .. 'Shoes'), Player:GetAttribute('ShoeInventory'))
end)
end
Players.PlayerRemoving:Connect(PlayerRemoved)
So I guess the question now is, what am I doing wrong when I set this data that causes it to be set as “502 error yadda yadda blah blah” ?
I would like to mention that this has been happening for a while and I do not think is connected to any current service disruptions…