Reliably detect if an instance is truly new and has never had its properties changed?

Hi!

Basically I’m creating a plugin where I want to override some of the default properties of gui objects when one is created in the game so I don’t have to keep removing border outlines on every single frame since I never use it.

Since I couldn’t find any event specifically for when an instance is added to the game (as in through insert object only) I had to do the next best thing that I could think of: looping through tables of properties with every single default value for each class that is a part of the abstract class GuiObject. I tried searching through google and the devforum but had no luck.

Does anyone have any idea on if this really is the best approach and if so, is there any way I should be doing it better so it’s more reliable? Because if Roblox adds a new property and I’m not looking for it in my table(s) then the player can make a change to that property, duplicate the object, and then have the changes that my plugin applies to that instance even though there were changes to it - thus editing an instance that isn’t the clean default.

Thanks!

1 Like

Do you really need to find when an instance was added?

You could just make the plugin change specific properties of all selected objects in Studio through Selection service if they’re of the class GuiObject.

1 Like

I’m looking for a method that is entirely automatic or else it just removes the purpose of creating the plugin in the first place.

1 Like

You could just override all desired instance’s property then, or is there more to why you need to track how old it is?

Edit:

You can insert some objects into a table as an exception, while looping check if an object exists under that table and if it does, then don’t alter any property.

The issue with that is I need to make sure to have sanity checks so I’m not overriding on elements that I want to keep certain properties on. For example, I may want to override the default property for new TextLabels/TextButtons from SourceSans to Gotham. But I don’t want to in the process revert any labels that may already have SourceSans on them if I’d rather have it for only few.

1 Like