Hello! I am working on a game which has many ui that look similar but have their differences. Things they share in common are exit buttons and purchase buttons. There are around 20 of those ui for different purposes. Every time i want to revamp / update the ui to make it look “better”, I have to manually go through every single ui to do this, which is getting tedious. Is there a way to update all those ui in an efficient way? I looked into collection service but I’m not sure how it would help out in my case. An example collection service is good for is lots of kill parts with only one script. However I want to be able to see the new updated ui in roblox studio as well, not just in the game. Is there anyways to do this? Thanks in advance if you read all the way until here!
Edit: If you can help me find a good solution for this problem I am willing to tip you robux as well (5-10k)
One method I would try is to add a script that loops through each of the menus and carries out an event when the exit or purchase buttons. Here is what it may look like for a close button:
for i, Gui in pairs(script.Parent:GetChildren()) do
if Gui:IsA("ScreenGui") then
if Gui:FindFirstChild("Close") then
-- Code would go here
Gui.Enabled = false
end
end
end
You would have to name the buttons the same thing in each menu for this to work. Alternatively, you could create a module system where it clones ui elements to use for each item and then it could load the information from a table in the script or folders in the game files.
Here is an example of how that code may look:
for i, Item in pairs(script:WaitForChild("Items"):GetChildren()) do
local Clone = script:WaitForChild("ItemTemplate"):Clone()
-- Edit properties of UI elements based on the info of the item (e.g. Image, Name etc)
Clone.Parent = script.Parent -- Parent it to a Screen Gui or another element in a screen Gui
Clone:WaitForChild("Purchase").MouseButton1Click:Connect(function()
-- Code would go here
end)
end
Similarly, you could also have 1 UI element which you update with the corresponding information based on the items details by changing properties of different UI elements.
This is what i had in mind, but the thing is I can only see the uniformed ui (new ui) when i click play, and in studio i still see the old ui, however if there isn’t other better way, i will use this method
I can’t think of a way except components but since you wanted to see them in studio u can just run and copy + paste, if that doesn’t suit you, you can make a plugin that will create the components from ur code and place them for u then u manually delete the rest. Last thing is, if ur using images then just give all images of the same ID the same tag then loop through all items with that tag and update their image ID when needed.
Yes, it does work, what you will make is basically a plugin that’ll update color, size, position, corner radius, stroke, etc. of all objects with a specific tag using a config file, for example if u edit the config then update, all elements with the same tag will update. I can make you the plugin if you want but I would need more details about the UI. If you’re not willing to share this publicly feel free to PM or DM in Discord, username is msix29.
It’s possible to do everything in a plugin, even more than in normal scripts, only limitation is user input isn’t detectable inside dock widgets using UserInputService.