So, I am working on an ordering system (https://www.candsavor.com). I am trying to clone a template into two different frames but it does not seem to be cloned and parented to both frame. It works for one frame. Here’s the script:
game.ReplicatedStorage:WaitForChild("CandsavorEvents"):WaitForChild("addToCart").OnServerEvent:Connect(function(plr, quantity, name, description, imageid)
for i = 1, quantity do
local Clone = script.CartSlotTemplate:Clone()
Clone.Parent = plr.PlayerGui.KioskUI.MainFrame.Cart.Cart
Clone._Name.Text = name
Clone._Description.Text = description
Clone._Icon.Image = imageid
end
for i = 1, quantity do
local AnotherClone = script.CartSlotTemplate:Clone()
AnotherClone.Parent = plr.PlayerGui.KioskUI.MainFrame.Home.Cart
AnotherClone._Name.Text = name
AnotherClone._Description.Text = description
AnotherClone._Icon.Image = imageid
end
end)
It parents the clone into plr.PlayerGui.KioskUI.MainFrame.Cart.Cart but it doesn’t into plr.PlayerGui.KioskUI.MainFrame.Home.Cart. I tried printing and see if the second loop runs, and it actually ran. Not sure why cloning isn’t working, pretty odd. It doesn’t give any error either.
UI
= Frames i want the TemplateSlot to be parented to.
Is that an actual script or local script and where is it parented also i belive its already clone because you didnt set its position so its gonna be at the same spot thus you wont notice if its clone
As I mentioned, it did not give any error. And I also tried printing on the second loop, and it actually printed. Which means, the second loop runs, it just does not clone.
Do the same thing for the 2nd code but change Clone with AnotherClone and First Code with Second Code, then run the game and tell us what was written on the console.
I may have an idea of what to do.
I’ve read the whole thing, and it seems pretty normal.
Try running it again and click on the print parent so you can see where it leads you to, maybe you wrote the wrong directory and it’s being cloned to somewhere else.
Are you firing the event twice? Maybe this is messing up with the script.
Are the frames visible true or false? If you’re supposed to see the frame try checking if it’s visible.
I still couldn’t find a way out. And yes, I have tried all of them - in explorer it doesn’t add the Template to the following parent meaning it’s not issue. What I will do now is, use ChildAdded and ChildRemoved event for the frame that actually works fine, and clone it locally in a different local script. Thanks for your help!