PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetRequestBudgetForRequestType

This function returns the number of data store requests that the current place can make based on the given enum/DataStoreRequestType. Any requests made that exceed this budget are subject to Articles/Datastore Errors|throttling. Monitoring and adjusting the frequency of data store requests using this function is recommended.

Parameters

Name Type Default Description

Returns

Return Type Summary

int


Code Samples


Print Request Budget

local DataStoreService = game:GetService("DataStoreService")
local globalStore = DataStoreService:GetGlobalDataStore()

local function printBudget()
	local budget = DataStoreService:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.SetIncrementAsync)
	print("Current set/increment budget:", budget)
end

for i = 1, 5 do
	local key = "key" .. i
	local success, err = pcall(function()
		globalStore:SetAsync(key, true)
	end)
	if success then
		printBudget()
	else
		print(err)
	end
end