Am I doing this right? I'm trying to make this script save all of the data from from my GUI. Like for example; I made a quest GUI and a player have to collect a certain of stone and if they collect one of them, then the image will show up. an you guys help me? Thank you for your time!
This is a normal script
script.DataStoreLib.Parent = Game.ServerStorage
wait()
script:Destroy()
This is a module script that is place inside of the normal script.
DataStore = {}
DataStore.__index = DataStore
function DataStore.ds(name)
if type(name) ~= "string" then return end
local ds = game:GetService("DataStoreService"):GetDataStore(name)
local meta = {}
setmetatable(meta, DataStore)
meta.data = ds
return meta
end
function DataStore:set(key, value)
self.data:SetAsync(""..key, value)
end
function DataStore:get(key)
return self.data:GetAsync(key)
end
return DataStore

2 comments
Module scripts need to be "required" in order to make them run/ use them
How can I do that? I never done this before. D: