Multiple values from one

Can Someone Help me with this
The ID is the value and i want to save this but it also changes after a while and i also wanna save that so that i have both of them saved

local function saveData(player, ID, Name) -- The functions that saves data
	
	

	local tableToSave = {
		
	}
	local success, err = pcall(function()
		dataStore:SetAsync("Vids", tableToSave) -- Save the data with the player UserId, and the table we wanna save
	end)

	if success then -- If the data has been saved
		print("Data has been saved!")
		
		
	else -- Else if the save failed
		print("Data hasn't been saved!")
		warn(err)		
	end
end
1 Like

The ID is the value and i want to save this but it also changes after a while and i also wanna save that so that i have both of them saved

Please try to be a bit clearer as this is confusing to read.

Do you mean you want to save a player’s data, then if a second player is using it then save the 2nd player’s data instead?

Or when the information you want to save has changed you want to change the saved value?

1 Like

Ok i want to save a value and if a new value from the ID value comes i want to save both etc
and i want everyone to get the value

1 Like

Why not save it to a table without the player name?
Or for example, if you want everyone to be upgraded to ‘level 2’ because ‘PlayerX’ got them there then save 2 tables, one for the level (data) and one for the player name.

1 Like

I want it to be more like uploading or smth like that like upload a value and it stays there

So save that value to the player’s data, whether just in game, or to dataStores.
If their value changes then first save it, then update the script that needs the value.
When your script reads the values saved to each player, compare them and use the highest value of all of them.