Question, How Do You Clone GUI?

As the name says it all, need help on GUI Clone. i’m making a button that Goes down, up, and changes colors. it also launches Magnifying Glasses up. I need to find out how to Clone and Randomly put those Clones in random locations. Here’s the Script:

local glassClone = --Glass Clone identifier 
local frame = script.Parent
local button = script.Parent.Parent
local function onButtonActivated()
	frame.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
	button:TweenPosition(UDim2.fromScale(0.394,0.700),Enum.EasingDirection.In,Enum.EasingStyle.Sine, 0)
	task.wait(0.1)
	frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
    button:TweenPosition(UDim2.fromScale(0.394,0.654),Enum.EasingDirection.In,Enum.EasingStyle.Sine, 0) 
    --Random location code
    glassClone:TweenPosition(UDim2.fromScale(0.5,8),Enum.EasingDirection.In,Enum.EasingStyle.Sine, 3)
end
button.Activated:Connect(onButtonActivated)

I hope you have an solution.

To cline it use Clone(), and to make it in a random pos read the answer to this post: How would I make a gui appear on a random spot on the screen

1 Like

But @Bopthing1 How do i Cline it to Clone()

Just simply use :Clone() to clone it. And if you want to put it in a random location, just do something like this:
(Rough estimate so don’t judge)

local randPosX = math.random(1,8)
local randPosY = math.random(1,8)
local object = -- insert object here
object:Clone().Position = UDim2.new(randPosX/10,0,randPosY,/10,0)
1 Like