Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function get_data(player_id, tries)
- tries = tries or 0
- if tries ~= 3 then
- local success, data
- if data_store_service:GetRequestBudgetForRequestType(get_async_enum) > 0 then
- success, data = pcall(main_data_store.GetAsync, main_data_store, player_id)
- else
- repeat
- wait(1)
- until data_store_service:GetRequestBudgetForRequestType(get_async_enum) > 0
- success, data = pcall(main_data_store.GetAsync, main_data_store, player_id)
- end
- if success then
- return data
- else
- warn(
- "Failure to load "..player_id.."'s data on try: "..tries..".",
- "\n",
- "Error: "..data
- )
- tries = tries + 1
- wait(7)
- return get_data(player_id, tries)
- end
- else
- return "ERROR"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment