(https://gyazo.com/2c4b935ddb95b9c016cefe057b05e7f6)(https://gyazo.com/e17034b17f048b617c2640b778e3ac14)
This is the code i am using but it’s not placing the rest of the stuff under the located areas in the gyazo’s “For example bonecrush suppose to have purchased and upgrade under it but it’s not going there at all” it only places bonecrush and nothing else under bonecrush goes with it
local StatTable = {}
local decode = HttpService:JSONDecode(StatData)
for i,v in pairs(decode) do
StatTable[i] = {}
if v and type(v) == "table" then
for x,y in pairs(v) do
StatTable[i][x] = y
end
else
StatTable[i] = v
end
end
for i,v in pairs(StatTable) do
--print(i)
local DataName = i
local DataValue = v
local BaseStat
if type(v) == 'table' then
BaseStat = Instance.new('NumberValue')
BaseStat.Name = DataName
for x,TableContents in pairs (v) do -- x is name and table contents is the value
local NewDataValue = TableContents
local InstancedValue
if type(NewDataValue)== 'number' then
InstancedValue = Instance.new('NumberValue')
elseif type(NewDataValue)== 'string' then
InstancedValue = Instance.new('StringValue')
elseif type(NewDataValue)== 'boolean' then
InstancedValue = Instance.new('BoolValue')
elseif type(NewDataValue)== 'userdata' then
InstancedValue = Instance.new('Color3Value')
elseif type(NewDataValue)== 'table' then
InstancedValue = Instance.new('BoolValue')
end
InstancedValue.Name = x
InstancedValue.Value = TableContents
InstancedValue.Parent = BaseStat
end
else
if type(DataValue)== 'number' then
BaseStat = Instance.new('NumberValue')
elseif type(DataValue)== 'string' then
BaseStat = Instance.new('StringValue')
elseif type(DataValue)== 'boolean' then
BaseStat = Instance.new('BoolValue')
elseif type(DataValue)== 'userdata' then
BaseStat = Instance.new('Color3Value')
elseif type(DataValue)== 'table' then
BaseStat = Instance.new('BoolValue')
end
BaseStat.Value = DataValue
BaseStat.Name = DataName
end
BaseStat.Parent = Stats.Data1
end