Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I make it so I have as much GUI buttons visible as a value?

For example if I have a value with 5, it would show 5 buttons. How would I do that?

1 answer

If you don't already have the buttons made, you would do this

local value = 5
loca gui = path to gui

 for i=1, value do
	local button = Instance.new("Button",gui)
	button.Visible = true
	button.Size = UDim2.new(0,100,0,100) -- change this to however you want
end

If you have all the buttons already

local value = 0 -- equal to 0
local value1 = 5 -- equal to how many buttons you want

local gui = make this the screengui with all the buttons

for i,v in pairs(gui:GetChildren()) do
	value = value + 1
	if value <= value1 then
		v.Visible = true
		elseif value > value1 then
		print("no more buttons")
	end
end

I was kinda confused by this so if this doesn't work add me on discord [in my bio] and I can get more context

.

This discussion is preserved as it was. New answers, comments, and votes are closed.