Remotes.SaveStats.OnServerEvent:Connect(function(plr)
local pid = plr.UserId
local Stats = plr.PlayerStatTable
local SaveStats= {}
for _,v in pairs(DeFolder(Stats)) do
if DeFolder(v) then
local Dictionary={}
for _,va in pairs(v:GetChildren()) do
Dictionary[va.Name] = va.Value
end
SaveStats[v.Name] = Dictionary
else
SaveStats[v.Name] = v.Value
end
end
Mod.SaveStats(pid,SaveStats)
return SaveStats
end)
But when I load it with
Remotes.LoadStats.OnServerEvent:Connect(function(plr)
local pid = plr.UserId
local Stats = plr.PlayerStatTable
local LoadedStatTable = Mod.LoadStats(pid)
for a_,v in pairs(LoadedStatTable) do
for _,va in pairs(v) do
print(va)
end
end
end)
This returns index:table for all of the items. Every Single value is a table. And the full table looks like this. Idk why it's happening
local StatFormula = {
["Level"] = 1,
["Inventory"] = {},
["Pets"] = {},
["MaxHealth"] = 100,
["MaxStamina"] = 100,
["BeastCoins"] = 0,
["Diamonds"] = 0,
["Scrolls"] = 0,
["EnchantedScrolls"] = 0,
["Metal"]=0,
["Wood"]=0,
["Cloth"]=0,
["GodFiber"]=0,
["GodDiamond"]=0
}
Anyone know what's happening? Thanks!

2 comments
Why is the OnServerEvent listener returning a value? Use a remote function instead.
ok