Can someone please help we with the code I currently have. I currently have a code for two leaderstats, cash & points. The points leaderstats main script is apart of an ordering system and the cash leaderstat is added on to that script. In game they both show up both show up but the stats are exactly identical everytime I join the game. Code:
You can just use a table! Here’s an example below:
-- use this when you want to save data
local PointsValue = -- the point object value
local CashValue = -- the cash object value
local Data = {
Points = PointsValue.Value,
Cash = CashValue.Value
}
-- make sure to use a pcall for handling data, as it may error some times and cause data loss due to roblox going down
local success, message = pcall(function(
DataStore:SetAsync(player.UserId, Data)
end)
if not success then
-- do whatever you want to happen whenever the data fails to save
end