How do I make a scrollingframe that automatically adds buttons from a folder in the replicatedstorage?
COMMUNITY QUESTION
How do I make a scrollingframe that automatically adds buttons?
1 answer
I'm assuming you mean that you have a folder of objects in ReplicatedStorage and you want to create a ScrollingFrame with a button for each object. If so, the easiest way would be to create a for loop that loops through each object and creates a button for it.
-- Make sure this is in a LocalScript
local frame = Instance.new("ScrollingFrame", game.Players.LocalPlayer.PlayerGui.ScreenGui) -- Make sure you create a screengui to put this in
frame.Size = UDim2.new(0, 125, 0, 100)
Instance.new("UIListLayout", frame) -- Automatically spaces the buttons for you
for _,v in pairs(game.ReplicatedStorage.YOURFOLDER:GetChildren()) do
local button = Instance.new("TextButton", frame)
button.Text = v.Name
button.Size = UDim2.new(1,0,25,0)
end
frame.CanvasSize = UDim2.new(1,0,0,#game.ReplicatedStorage.YOURFOLDER:GetChildren()*25)
You can edit the values of the size and position of the objects in there as needed to fit your needs.
If you're looking for more information, the developer wiki has plenty of resources:
https://developer.roblox.com/articles/Creating-a-Scrolling-Frame-GUI https://developer.roblox.com/articles/Fundamentals-of-Scripting-with-GUIs https://developer.roblox.com/articles/Creating-GUI-Buttons
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
your question does not make any sense.
how does it not
You have a scrolling frame that you want to have a button in for each of whatever you have in your folder that is inside ReplicatedStorage, correct?
yes
This is not a request site; Please try to attempt it instead of asking how to do it first. Google it and find your answer, if the code you used doesn't work, make a question and people will help you