My goal is to create tiles with a viewportframe in those for every skin there is in the table, copy the skin from replicatedstorage to the viewportframe, and display it, however nothing is appearing.
No errors in console, tried looking for a solution and found none.
Viewportframes are where the red squares are shown
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Skins = ReplicatedStorage.Skins:GetChildren()
local SkinsFolder = ReplicatedStorage.Skins
local UIGridLayout = script.Parent.UIGridLayout
local ScrollingFrame = script.Parent
local RemoteFunc = ReplicatedStorage.Remotes.SendShopBuyReq
local PreviewFrame = script.Parent.Parent.Preview
local PreviewViewPort = PreviewFrame.Viewportback.ViewportFrame
local PreviewTitle = PreviewFrame.Title
local PreviewCost = PreviewFrame.Cost
local PreviewBuyButton = PreviewFrame.BuyButton
local Sample = script.Parent.Sample
local SViewPort = Sample.ViewportFrame
local SCostText = Sample.Cost
local SNameeText = Sample.Namee
local SButton = Sample.Button
local SkinsTable = {
["Default"] = {Name = "Default", Price = 0, Description = "Your first sword skin.", Unobtainable = "False"},
["BetaTester"] = {Name = "Beta Tester", Price = 1, Description = "Awarded to Beta Testers", Unobtainable = "True"},
}
for skin, data in pairs(SkinsTable) do
local newSample = Sample:Clone()
newSample.Parent = ScrollingFrame
newSample.Name = skin
newSample.Namee.Text = data.Name
newSample.Cost.Text = data.Price.. " Kills"
local skinModel = SkinsFolder:FindFirstChild(skin)
if skinModel then
local newSkin = skinModel:Clone()
newSkin.Parent = newSample.ViewportFrame
local camera = Instance.new("Camera")
camera.Parent = newSample.ViewportFrame
SViewPort.CurrentCamera = camera
camera.CFrame = CFrame.new(Vector3.new(0, 2, 12), newSkin.Handle.Position)
end
newSample.Button.MouseButton1Click:Connect(function()
PreviewTitle.Text = data.Name
PreviewCost.Text = data.Price .. " Kills"
end)
end