Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- minimic2002's DataStore Script
- local DataStoreService = game:GetService("DataStoreService")
- function SetData(Store,Player,Data)
- local NewStore = DataStoreService:GetDataStore(Store)
- NewStore:SetAsync(Player,Data)
- end
- function UpData(Store,Player,Data)
- local NewStore = DataStoreService:GetDataStore(Store)
- NewStore:UpdateAsync(Player,Data)
- end
- function GetData(Store,Player)
- local NewStore = DataStoreService:GetDataStore(Store)
- local Result = NewStore:GetAsync(Player)
- return Result
- end
- function RemoveData(Store,Player)
- local NewStore = DataStoreService:GetDataStore(Store)
- NewStore:SetAsync(Player,nil)
- end
- function CheckForExistingData(Store,Player)
- local Data = GetData(Store,Player)
- if Data == nil then
- local Result = false
- return Result
- else
- local Result = true
- return Result
- end
- end
- function CreateListing(Store,Data)
- local EntryCount = GetData(Store .. "EntryCount","EntryCount")
- if tonumber(EntryCount) == nil then
- EntryCount = 0
- end
- EntryCount = tostring(tonumber(EntryCount) + 1)
- SetData(Store,EntryCount,Data)
- SetData(Store .. "EntryCount","EntryCount",EntryCount)
- end
- function GetListings(Store)
- local EntryCount = GetData(Store .. "EntryCount","EntryCount")
- EntryCount = tonumber(EntryCount)
- local StoreNames = {}
- for i = 1, EntryCount do
- local Name = tostring(i)
- local Check = CheckForExistingData(Store,tostring(i))
- if Check == true then
- table.insert(StoreNames,Name)
- end
- end
- return StoreNames
- end
- function RemoveListing(Store,Number)
- local EntryCount = GetData(Store .. "EntryCount","EntryCount")
- local NewStore = DataStoreService:GetDataStore(Store)
- NewStore:SetAsync(Number,nil)
- end
- function GetEntryCount(Store)
- local EntryCount = GetData(Store .. "EntryCount","EntryCount")
- EntryCount = tonumber(EntryCount)
- return EntryCount
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement