7You Can Now Easily Delete Any Or All DataStores. Just Insert This Script Into Any Script And Run!
Could still use little improvement for overloading and performance but does what it’s supposed to do.
For Deleting One DataStore:
local DataStoreService = game:GetService("DataStoreService")
-- Insert DataStore Name Here vvv
local DataStoreName = "TestDataStore"
local DataStore = DataStoreService:GetDataStore(DataStoreName)
local Success, Pages = pcall(function()
return DataStore:ListKeysAsync()
end)
if not Success then warn("Timeout") return end
while task.wait() do
local Items = Pages:GetCurrentPage()
for _, Data in ipairs(Items) do
-- Deletes Data:
local Key = Data.KeyName
DataStore:RemoveAsync(Key)
task.wait(3)
end
if Pages.IsFinished then break else Pages:AdvanceToNextPageAsync() end
end
For Deleting All DataStores:
local DataStoreService = game:GetService("DataStoreService")
local Success, DataStorePages = pcall(function()
return DataStoreService:ListDataStoresAsync()
end)
if not Success then return end
-- Gets Data Store Names:
local DataStoreNames = {}
while task.wait() do
local DataStorePage = DataStorePages:GetCurrentPage()
for _, DataStore in pairs(DataStorePage) do
table.insert(DataStoreNames, DataStore.DataStoreName)
end
if DataStorePages.IsFinished then break else DataStorePages:AdvanceToNextPageAsync() end
end
-- Gets Data Of DataStores:
for _, DataStoreName in ipairs(DataStoreNames) do
local DataStore = DataStoreService:GetDataStore(DataStoreName)
local Success, Pages = pcall(function()
return DataStore:ListKeysAsync()
end)
if not Success then warn("Timeout") continue end
while task.wait() do
local Items = Pages:GetCurrentPage()
for _, Data in ipairs(Items) do
-- Deletes Data:
local Key = Data.KeyName
DataStore:RemoveAsync(Key)
task.wait(3)
end
if Pages.IsFinished then break else Pages:AdvanceToNextPageAsync() end
end
end
Bruh