Hey all! I have a script in ServerScriptService with all the DataStores in my game defined and all self updating - how can I "Re-use" this in other scripts by "SetAsyncing" data using that script without having to recall the DataStores?
local OilRigData = game:GetService("DataStoreService"):GetDataStore("BestOilRigOverall") local OilRigDataUserId = game:GetService("DataStoreService"):GetDataStore("BestOilRigOverallUserId") local data = {dataone = OilRigData:GetAsync("BestOilRigOverall"), datatwo = OilRigDataUserId:GetAsync("BestOilRigOverallUserId")} local OilRigConnection = OilRigData:OnUpdate("BestOilRigOverall", function(newValue) data.dataone = newValue end) local OilRigUserIdConnection = OilRigDataUserId:OnUpdate("BestOilRigOverallUserId", function(newValue) data.datatwo = newValue end) function game.ReplicatedStorage.RemoteFunctions.GetData.OnServerInvoke(player) return data end
From another script I can "GetAsync" this data by Firing a RemoteFunction and print(data.dataone) but how can I use this (or a similar script) to Set Astnc the DS's in a similar way? Preferably I would like to do something like data.dataone = 122 if possible! :slightly_smiling:
Any tips/help appreciated. Thanks!