This script is supposed to create a frame for each skin from a table although when testing it just clones the same skin into a frame for the amount of skins there are in the table. Any help is appreciated.
Gui:
function CreateFrame(List)
for index, Skin in pairs(List) do
local Frame = Template:Clone()
Frame.Name = Skin.Name
Frame.Title.Text = Skin.Name
Frame.Image = Skin.Image
Frame.Cost.Text = "Ashes "..Skin.Cost
Frame.Parent = Skins
return Frame
end
end
local SkinsList = require(SkinsFolder:WaitForChild("SkinsList"))
function CreateSkins(Data)
for i, v in pairs(Data) do
local Frame = CreateFrame(Data)
end
end
SendData.OnClientEvent:Connect(function()
CreateSkins(SkinsList)
end)
Table:
local Skins = {
Ashes = {
["Name"] = "Ashes",
["Image"] = "rbxassetid://9217837283",
["Cost"] = 0,
},
Unloved = {
["Name"] = "Unloved",
["Image"] = "rbxassetid://9217836267",
["Cost"] = 500,
},
Bush = {
["Name"] = "Bush",
["Image"] = "rbxassetid://9217836845",
["Cost"] = 900,
},
}
return Skins