I am making a DataStore module for ease of access and I plan on releasing it soon but I would like to know how can I check if a DataStore already exists? ( have a method but I am afraid it will flood DataStore requests. Here is the method :

for _, v in pairs(DataStoreService:ListDataStoresAsync()) do 
	if v.Name == DataStore.Name then 
		return warn("Use an existing datastore!") 
	end 
end

2 comments

0

you iterate the pages incorrectly, see code at the bottom here: https://developer.roblox.com/en-us/api-reference/function/DataStoreService/ListDataStoresAsync it won't flood data store

0

both options are optional