How should I store this value in a way that it can save?

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 are an optional thing that you can choose to use if you believe it fits your game

number values work with data stores but objects don’t, save the “energy” value and replace the instance whenever you need to reload the game

ohh so it means that values work with datastores? i thought only leaderstats worked

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}

would that save for each and individual player (for obvious reason I don’t want it to mess up other players data)

talking about not saving leaderstats in the datastore

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)