How can I get the values of the value into one table?

Sorry if the title seems a bit confusing but i’m trying to get all the values for these values into one table so it can work for the datastore.

Currently this is the only way data actually saves but this way is extremely inefficient so how can i get all the values of the savingValues into one table

the only way it works

You’d want to save them in a dictionary so you can easily access them:

local toSave = {
    cutlassValue = cutlassValue.Value,
    daggerValue = daggerValue.Value,
    etc..
}

You could automate by this doing the following:

local toSave = {}
for _,value in pairs (playerValues:GetChildren()) do
	toSave[value.Name] = value.Value
end

In this instance you’d get them using loaded.Bounty or loaded['Bounty'] (where loaded is what you get from your DataStore, assuming my automated toSave was used).

4 Likes

I actually can’t believe it. It worked! Thank you! You have no idea how much easier I will sleep after knowing this problem is fixed. I don’t know how I can thank you enough.

1 Like