Error in script

Hey, I was just working on a script and ran into this…

    local Frame = Instance.new("Frame", UI.BackgroundCornerColor)
	
	Frame.BackgroundTransparency = 1
	Frame.Size = UDim2.new(1, 0, 1, 0)
	
	Frame.Name = "Left"
	Frame:Clone().Name = "Right"
	Frame:Clone().Name = "UP"
	Frame:Clone().Name = "Down"

it’s only creating Frame Left but not others.
Anyone know why is this happening ?

I’m not sure if cloning is actually needed, but that might beghe oroblem(?)

You didn’t even parent it? Did you even read this code?

1 Like

I want the frame to be cloned 4 times… but when I use :Clone(), it’s appearing

Then simply make it 4 times…

Also what @SubtotalAnt8185 said

I did parent it in the first line itself, I guess :Clone() should parent it to the same

Because you arent Parenting the Instance, if you dont Parent it, Its set Parent is nil.

1 Like

No, :Clone parents it to nil. Also, you should be iterating over Enum.NormalId.

2 Likes

Oh I didn’t know this

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.