Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to clone a GUI without multiplying them?

I made a button where if u click the button, the button clones, i place the button in the frame and when i click it once, it clones once but when i click it for the second time, it clones twice, its like its multiplying instead of adding up. heres the code:

`local frame = script.parent.parent`

local button = script.parent

`button.mousebutton1click:connect(function()`
`local NewButton = frame:FindFirstChild("TextButton"):clone()
NewButton.Name = "NewButton"
NewButton.Parent = frame`

`end)`

1 comment

0

you've made it quite hard to read when you spammed `` on your code lol

1 answer

it's bc the buttons are stacked on each other and so u click them all at the same time.

Just add in a UIGridLayout into the frame, it will space them out for you.

2 comments

0

I already add a UIGridLayout, what i meant is that when i click the button for the second time, my expectation was for it to clone once, for ex, 1 +1. But it multiplies instead, for ex, 1 +2

0

I haven't been able to reproduce this mine works just fine

This discussion is preserved as it was. New answers, comments, and votes are closed.