New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

Why Is The Selection Service Broken But Working At The Same Time For Me?

Asked by 10 days ago
Edited 10 days ago

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 "". 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")
    local Button ="ImageButton")
    Button.Name = "Name" -- Just Gonna Put the name later
    Button.Size =, 281,0, 225)
    Button.ScaleType = Enum.ScaleType.Slice
    Button.SliceCenter =,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

Answer this question