I’m using a simple datastore script from DataStores - Beginners to Advanced but upon execution I cannot save nor create due to the error in the title.
local function safeCall(playerName, func, self, requestType, ...)
local success, ret
repeat
if requestType then
waitForRequestBudget(requestType)
end
success, ret = pcall(func, self, ...)
if not success then
print("Error: " .. ret)
if string.find(ret, "501") or string.find(ret, "504") then
return
end
end
until (success) or (playerName and not Players:FindFirstChild(playerName))
return success, ret
end
local _, pages = safeCall(name, orderedDataStore.GetSortedAsync, orderedDataStore, Enum.DataStoreRequestType.GetSortedAsync, false, 100)
local currentPage = pages:GetCurrentPage()
if #currentPage > 0 then
for _, dataStoreKey in ipairs(currentPage) do
if not Players:FindFirstChild(name) then return end
dataStoreKey = dataStoreKey.value
local success, ret = safeCall(name, dataStore.GetAsync, dataStore, Enum.DataStoreRequestType.GetAsync, dataStoreKey)
if success then
str.Value = ret
TIX.Value = ret
TIX.Parent = leaderstats
str.Parent = player
leaderstats.Parent = player
break
end
end
else
str.Value = ""
str.Parent = player
TIX.Value = 100
TIX.Parent = leaderstats
leaderstats.Parent = player
end
I tried to get userid from name but it didn’t work either.