Yo Alright, here’s the rundown
WHAT MY SCRIPT DOES
My script takes the decals that are inside of a folder, turns them into ImageButton’s, and shows them inside of my GUI
MY PROBLEMS
When I click to add the button to the workspace, here’s my two problems:
When I click, my script detects if a screen gui is inside of StarterGui, and if it isn’t, then it will add in the screen gui along with the button, and if it is then it will parent it to the screengui, but my problem is that I click to add and everything works, but it just creates another screengui with nothing inside of it, which clutters up my StarterGUI
My second problem is that when I click the button, it shows up in StarterGUI, but doesn’t show up in-game.
It’s supposed to be in the top right hand corner! I already checked the properties, and that’s not the problem.
MY SCRIPT
local scrollingFrame = script.Parent
local decals = script.Parent.Decals
for index, value in pairs(decals:GetChildren()) do
if value:IsA("Decal") then
local iButton = Instance.new("ImageButton")
iButton.Image = value.Texture
iButton.Parent = scrollingFrame
iButton.Size = UDim2.new(0.1, 0, 0.1, 0)
iButton.Transparency = 1
iButton.Visible = true
iButton.MouseButton1Click:Connect(function()
local screengui = Instance.new("ScreenGui")
screengui.Parent = game.StarterGui
screengui.Name = "Interface Library V1.0.0 - LITE - Inserted Elements"
if game.StarterGui["Interface Library V1.0.0 - LITE - Inserted Elements"] then
local button = Instance.new("ImageButton")
button.AnchorPoint = Vector2.new(0.5, 0.5)
button.AutoButtonColor = false
button.BackgroundTransparency = 1
button.Name = "Inserted Element"
button.Parent = game.StarterGui["Interface Library V1.0.0 - LITE - Inserted Elements"]
button.Position = UDim2.new(0.9, 0, 0.5,0)
button.Size = UDim2.new(0.098, 0,0.158, 0)
button.Image = iButton.Image
button.ScaleType = "Fit"
else
local button = Instance.new("ImageButton")
button.AnchorPoint = Vector2.new(0.5, 0.5)
button.AutoButtonColor = false
button.BackgroundTransparency = 1
button.Name = "Inserted Element"
button.Parent = screengui
button.Position = UDim2.new(0.9, 0, 0.5,0)
button.Size = UDim2.new(0.098, 0,0.158, 0)
button.Image = iButton.Image
button.ScaleType = "Fit"
end
end)
end
end
By chance did I miss anything or do something wrong? Let me know.