I don’t know why, but I would like to make a list inside of my game of all the game images. Similar to this I guess:
Is there any service or something that I can use?
Thanks,
doctorpepper126
I don’t know why, but I would like to make a list inside of my game of all the game images. Similar to this I guess:
Is there any service or something that I can use?
Thanks,
doctorpepper126
Yeah, you can.
Do this.
local replicaredStorage = game:GetService("ReplicatedStorage")
local imageList = replicatedStorage:WaitForChild("ImageList") --ImageList being a folder of the images you want
local Name_The_List_Whatever_You_Want{
["Name of the image you want"] = imageList:WaitForChild("Name of the image you want"),
["Name of the image you want 2"] = imageList:WaitForChild("Name of the image you want 2"),
}
That is a dictionary, and the way you can call the image is by doing this:
Name_The_List_Whatever_You_Want["Specific image in the dictionary you want"]
it could be used like this:
local Players = game:GetService("Players")
local replicaredStorage = game:GetService("ReplicatedStorage")
local plr = Players.LocalPlayer
local textButton = plr.PlayerGui:WaitForChild("MainGui"):WaitForChild("Frame"):WaitForChild("TextButton")
local imageLabel = textButton:WaitForChild("ImageLabel")
local imageList = replicatedStorage:WaitForChild("ImageList")
local Name_The_List_Whatever_You_Want{
["Name of the image you want"] = imageList:WaitForChild("Name of the image you want"),
["Name of the image you want 2"] = imageList:WaitForChild("Name of the image you want 2"),
}
textButton.MouseButton1Click:Connect(function()
imageLabel.Image = Name_The_List_Whatever_You_Want["Name of the image you want 2"]
end)
You can add as many things you want to the dictionary as long as you remember to put a comma at the end of each line.
Hope this is what you’re looking for
You could use UIListLayouts to order the frames automatically.
Add the UIListLayout as a child to a ScrollingFrame, and add all the element frames as children of the ScrollingFrame.