Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Clone not cloning frames for items in Shop?

Asked by
harstud 218 Moderation Voter
4 years ago

So basically, I am creating a shop for my game and I tested a thing to make frames of the Pets you can buy. But there's one problem. It doesn't clone the Template frame and you can't see what you can buy. A gif of the error: https://gyazo.com/673454de7a44109ac18d939d87014bb6 LocalScript:

local AvailableCount = 0
local Pets = game.ReplicatedStorage.PetItems:GetChildren()
local PetsAvailable = {}
for i = 1,#Pets do
    if Pets[i]:isA("Folder") then
        table.insert(PetsAvailable, Pets[i])
    elseif Pets[i]:isA("Model") then
        table.insert(PetsAvailable, Pets[i])
    end
    local Pet = script.Parent.FrameTemplate:Clone()
    Pet.Name = Pets[i].Name
    Pet.Image.Image = "rbxassetid://"..Pets[i].Image.Value
    Pet.Title.Text = Pet.Name
    Pet.Visible = true
    AvailableCount = AvailableCount + 1
    if AvailableCount == 1 then
        Pet.Position = UDim2.new(0.125, 0, 0.025, 0)
    else
        Pet.Position = Pet.Position + UDim2.new(0.375, 0, 0, 0)
    end
end

Thanks.

Answer this question