‘DataStoreService: InternalServerError: An internal server error occurred. API: GetAsync, Data Store: HDAdminSystemDataV1.0’
I can send the script if you need it to understand, thanks for any help.
‘DataStoreService: InternalServerError: An internal server error occurred. API: GetAsync, Data Store: HDAdminSystemDataV1.0’
I can send the script if you need it to understand, thanks for any help.
Did you enable api requests in the game settings ?
And does this error shows everytime you run the script ?
I don’t think it appears everytime, hold on ill run it again.
Heres my script incase you need it:
local function getUserGeneratedTShirtsRecursive(username, tshirts, cursor)
tshirts = tshirts or {}
cursor = cursor or ""
local requestUrl = baseUrl:format(username, cursor)
local success, result = pcall(function()
return http:GetAsync(requestUrl)
end)
if success then
if result then
local success2, result2 = pcall(function()
return http:JSONDecode(result)
end)
if success2 then
if result2 then
for _, tshirt in ipairs(result2.data) do
table.insert(tshirts, tshirt.id)
end
cursor = result2.nextPageCursor
if cursor then
return getUserGeneratedTShirtsRecursive(username, tshirts, cursor)
else
return tshirts
end
end
else
warn(result)
end
end
else
warn(result)
end
end
local exitButton = loser.PlayerGui.Donation.Frame.Exit
exitButton.MouseButton1Click:Connect(function()
loser.PlayerGui.Donation.Enabled = false
end)
loser.PlayerGui.Donation.Enabled = true -- THIS IS THE PART THAT SHOULD MAKE IT VISIBLE
local username = loser.Name
local winnerName = winner.Name
local userTShirts = getUserGeneratedTShirtsRecursive(winnerName)
local num = (#userTShirts)
game.ReplicatedStorage.Donation:FireClient(winner)
loser.PlayerGui.Donation.Frame.TextLabel.Text = "Donate to ".. winnerName
local table1 = {}
for i = num, 1, -1 do
local Asset = MarketPlaceService:GetProductInfo(userTShirts[i])
local assetPrice = Asset.PriceInRobux
local assetId = Asset.AssetId
if assetPrice == nil or assetId == nil then
print("Failure")
else
-- Create a new table for each item with the price and id
local item = {price = assetPrice, id = assetId}
-- Insert the item into the table
table.insert(table1, item)
end
-- Create a new table for each item with the price and id
end
table.sort(table1, function(a, b)
return a.price < b.price
end)
for i, item in ipairs(table1 or {}) do
if item then
local price = item.price or "default price"
local id = item.id or "unknown"
local newButton = workspace.DonateButton:Clone()
newButton.Text = price .. " R$"
local id = Instance.new("IntValue", newButton)
id.Value = item.id
newButton.Parent = loser.PlayerGui.Donation.Frame.itemsScroller
else
end
end
Yes, it doesn’t appear all the time.
The error means that the API request itself failed, which is why we pcall datastore requests, scenarios like this have a slight chance of happening once in a while.
You can try using retry logic, basically, if the request fails, reattempt the request:
local function someFunction(...)
local success, response = pcall(function()
return DS:GetAsync(someKey)
end)
if not success then
warn(response)
return someFunction(...)
end
--code that runs on success goes here
end
The above code won’t cause the game to crash/lag due to recursion because the GetAsync
function yields the thread for a small amount of time when making an actual attempt. However, it may have this crash/lag-like behavior if datastore requests are disabled from the game settings or if there’s an actual error in the function arguments/call.
Thank you very much for your help . I’ve been stuck on a bug in my code for 3 days, I don’t suppose you know whats going on? Fair enough if you don’t have time, I know theres quite a bit of code to read through.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.