Best way to update ui?

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)

2 Likes

I have a few possible sollutions.

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.

Hope this helps :slight_smile:

2 Likes

Look into a system similar to fusion components,

https://elttob.uk/Fusion/0.2/tutorials/components/reusing-ui/

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

doing this manually is tedious :rofl:

1 Like

This is similar to what I had in mind, the only thing being that I won’t be able to see the new ui in studio…

CollectionService works with UI aswell by the way.

Yup I know that, but is there a way for me to see the effects / changes in roblox studio when not playing?

you can make the guis by scripts and then copy them and paste in studio

1 Like

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.

1 Like

How would I make a plugin? Does collection service work in plugins?

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.

Is it possible to clone objects, delete objects, and move objects (parent propery) in a plugin?

I would want to learn how to make a plugin :smiley:

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.

As you wish.

could use a discord webhook or httpservice to send changes in UI

I just published a plugin but it won’t work. I had the exact same issue as this guy here:

How do I fix it?

It’s a personal plugin so you just need to save the plugin as a local plugin, also can you show me the error and the code that errored?

Try looking at this other plugin that does this job

1 Like