Issues with UI plugin

  1. What do you want to achieve? I’m trying to create a plugin that inserts scaled UI.

image

  1. What is the issue? When I insert a frame into a ScreenGui it works, but when I try to insert a frame or TextLabel into a frame it doesn’t work.

  2. What solutions have you tried so far? I tried parenting the inserted UI to the selected UI, but it just doesn’t insert it.

Here is an example of the code I used:

FrameInsert.MouseButton1Click:Connect(function()
local framenew = Instance.new("Frame", selection:Get()[1])
framenew.Size = UDim2.new(0.078, 0, 0.122, 0)
framenew.Name = "Frame"
framenew.Position = UDim2.new(0.5, 0, 0.5, 0)
framenew.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
framenew.BorderSizePixel = 0
framenew.AnchorPoint = Vector2.new(0.5, 0.5)
selection:Set({framenew})
end)