for i, v in pairs(ValuesTable) do
v.Value = sessionData[player.UserId][v.Name]
end
It works when I do this though:
for i, v in pairs(ValuesTable) do
v.Value = sessionData[player.UserId].JumpPower
end
But the issue with that is now everything is tied to the same savedata, but I need them each to be seperate, which is why I’m trying to change JumpPower to the name of the value, ex: Coins, Keys, etc…
And when I print v.Name, it comes out as their specified name, so I’m confused
I feel very silly rn, but I tried the thing and its not giving no more errors, but the data isn’t saving, I dont think I did it right but I’m not sure what to do
for i, v in pairs(ValuesTable) do
local value = tostring(tonumber(v.Value))
value = sessionData[player.UserId][v.Name]
end
for i, v in pairs(ValuesTable) do
v.Value = sessionData[player.UserId].JumpPower
end
for i, v in pairs(ValuesTable) do
v.Changed:Connect(function()
sessionData[player.UserId].JumpPower = v.Value
end)
end
and it saves the values, but it saves them all at the same value since theyre saving to “JumpPower”
for _, v in pairs(ValuesTable) do
local name = tostring(v)
print(name)
v.Value = sessionData[player.UserId][name]
end
for _, v in pairs(ValuesTable) do
v.Changed:Connect(function()
local name = tostring(v)
print(name)
sessionData[player.UserId][name] = v.Value
end)
end
This ended up working, even though its giving me the same error for some of them, for some reason, it still saves normally