How to save a value

ive been wondering how to save a value because my game has way too many values and they are not connected to datastore or anything so is there any way of saving a value

You will have to save them in a DataStore.
If these values are not specific to a player, but are values that apply to the game as a whole, just don’t use the player as the scope of the datastore, so you’ll have a generic datastore for the game.

so how would i do that? like:

local datastore = game:GetService("DataStoreService"):GetDataStore("Data")

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Parent = player
	leaderstats.Name = "leaderstats"

	local Gold = Instance.new("NumberValue")
	Gold.Parent = leaderstats
	Gold.Name = "Gold"

	local Rebirths = Instance.new("NumberValue")
	Rebirths.Parent = leaderstats
	Rebirths.Name = "Rebirths"

	local debounce = Instance.new("BoolValue")
	debounce.Value = false
	debounce.Name = "Debounce"
	debounce.Parent = player

	local key = "user-" .. player.userId

	local storeditems = datastore:GetAsync(key)

	if storeditems then
		Gold.Value = storeditems[1]
		Rebirths.Value = storeditems[2]
        Val.Value = storeditems[3] -- here
	else
		local items = {Gold.Value, Rebirths.Value}
		datastore:SetAsync(key, items)
	end
end)

game.Players.PlayerRemoving:connect(function(player)
	local items = {player.leaderstats.Gold.Value, player.leaderstats.Rebirths.Value}
	local key = "user-" .. player.userId

	datastore:SetAsync(key, items)
end)

DataStore is an important topic.
So, I think it’s more efficient you learn how to use DS before, through the various tutorials and documentation.