So I’ve been doing a game, kinda like raise a floppa where you need to keep an object filled with energy (it loses energy progressively and you need to refill it), the thing is that I want to save that value so that if the player leaves and come back the energy value is still there (the game is singleplayer, might add multiplayer tho), would I need too use leaderstats or no?
Leaderstats are for each single players and I more of want the leaderstat to be for the crystal, I just am not good at stats and storing values and info about players and objects so I just don’t know what I should use.
Leaderstats do not save anything they just display values on the leaderboard.
The answer your looking for here is Data Stores. If you’re new to it I recommend reading up on it, and watching a few videos if you still don’t understand, they seem hard but they really aren’t. If you want to save the energy of a specific object but not another your gonna want to save your data as a table:
local DataToSave = {["Floppa1"]=20, ["Floppa2"]=90}
You would have to create special save tables for each unique player.
local DataStoreService= game:GetService("DataStoreService")
local PlayerData = DataStore:GetDataStore("PlayerData")
local DataToSave = {["Floppa1"]=20, ["Floppa2"]=90}
local success, errorMsg = pcall(function()
PlayerData :SetAsync(player.UserId, DataToSave} -- UserId is the best key name because it is unique to that player and you can call it to load for that player when they join
end)