Here’s a system that I use, it’s small, sweet, and simple.
Code
local DATA_TEMPLATE = { -- your data here
}
local data = {}
local data_cache = {}
local DS = game:GetService("DataStoreService"):GetDataStore("YourDS")
local Players = game:GetService("Players")
function data.onPlayerAdded(player)
local data = DS:GetAsync("UID_"..player.UserId) or DATA_TEMPLATE
for index, value in pairs(DATA_TEMPLATE) do
if not data[index] then
data[index] = value
end
end
data_cache[player] = data
end
function data.get(player)
return data_cache[player]
end
function data.set(player)
local success, err = pcall(function() DS:SetAsync("UID_"..player.UserId, data_cache[player]) end)
if not success then
print(err)
end
end
return data
Outside of this script, Is their a way I can get a value for Dummy EXP?
Im trying to make it so that every time the Dummy completes the obby, a script will give the Dummy Xp but how can I get the value without it being in the Module Script?