You are needlessly wrapping your assignments in a table. The table constructor (the stuff contained within and including {}) does allow the usage of = inside of it, but that is extremely different from regular assignment. When constructing a table, the equals sign is used to set the keys of the table directly. By default, it assumes string keys, unless you wrap the key with [], which will then use the parsed expression contained inside the brackets.
local t = {
Something = 1, -- "Something" is the string key
["A Different Way"] = 2 -- You have to use brackets because of the spaces
}
is functionally equivalent to
local t = {}
t["Something"] = 1
-- or, equally
t.Something = 1
-- This format is required since spaces can't be used with the dot operator
t["A Different Way"] = 2
Here’s what you are (seeming to be) doing: You are making a table and trying to set its keys to Instance descendants. This does not change anything, because you are simply creating a new table with Instance keys. The actual Value objects aren’t changing because you’re not actually assigning to them, only accessing them.
Here’s what I think you want to do: You should directly assign to the entries’ Value members, as mentioned by others, in GunStatsFold. You don’t need to create a table, because the data is stored in the folder’s children. The syntax would be like GunStatsFold.MaxAmmo.Value = 17, without any surrounding table constructor.
If you want to store the stats in a table for some other utility, then just use string keys directly, as demonstrated above. Please do not do [GunStatsFold.MaxAmmo] = 17 or [GunStatsFold.MaxAmmo.Value] = 17 as these will be nonsense.
Additional Resources (at least skim these, please)
Programming in Lua, 2.5 - Tables
Programming in Lua, 3.6 - Table Constructors
Programming in Lua, 4.1 - Assignment
Programming Lua, fourth edition, Chapter 5. Tables (page 33)