Basically, I have been lately working on a plugin where it creates a GUI. When the GUI is made I dunno what parent should it be? I realized how about making the developer/player select the parent of the GUI. I mean there are tons of plugins that use the Selection Service like the Roundify plugin, where you can select what GUI you want to Roundify. I wanna do the exact same thing but not replacing the selected object into a whole new one, I wanna make the selected object to be the parent of the GUI that is made using the plugin I've been working. Did you get it? I hope so! So, back to the topic, I did search it up in the site with the URL "developer.roblox.com". I kinda understand it, but not that much. I used the for i,v loop in making my goal in the plugin which is the use of Selection Service because it happens to be working! but when I uploaded the plugin and tested it out, it's working like I've mentioned but when the second time the service ran it makes an excess copy of the GUI that is made using the plugin I am working on! And it does that all the time whenever the service ran! Did you get my point? Here's the script! Please tell me if I did something that causes it to make an excess copy!
local Selection = game:GetService("Selection") script.Parent.Frame.ProceedButton.MouseButton1Click:Connect(function() local Button = Instance.new("ImageButton") Button.Name = "Name" -- Just Gonna Put the name later Button.Size = UDim2.new(0, 281,0, 225) Button.ScaleType = Enum.ScaleType.Slice Button.SliceCenter = Rect.new(100,100,100,100) Button.SliceScale = 0.25 Button.BackgroundTransparency = 1 Button.Image = "Image" -- Just Gonna Put the image later for i,v in pairs(Selection:Get()) do Button.Parent = v end end)