Wow very fast turn around! glad you implemented some of the suggestions especially the new Audio API! Since on my current project I don’t use the old Sound I can finally change it real quick! for all the effects I made.
Since the effects rig are being reconstructed I can’t add any external functionality without coupling the effect to other systems by fetching the instances at creation using GetRigDependencies()
.
The only way to decouple the functionality is to use CollectionService to fetch any spawned effects with the tag and do some functionality. Attributes work hand in hand with the CollectionService as-well.
Here’s an ideas I came up on the fly (probably very specific scenario):
Assuming Attributes and Tags are animatable
I have an effect that spawns a firefly that emits light on and off. The firefly has a Tag of FireflyEffect the tag is applied at creation on frame 0 and a Boolean Attribute called IsLightOn and starts at false.
I animate the firefly to make it neon when the light is on, I also animate the Attribute to be true and vise-versa.
Lets say we have a mechanic in the game where we point the direction to where the closest firefly is when the light is on.
I can easily make a separate system de-coupled from the effect itself and the effect has nothing to do or need to know about this mechanic and its only sole job is to just animate it.
I can then use CollectionService to see the closest firefly from the character that currently spawn and check if their attribute IsLightOn is true.
I can easily extend this functionality to even more complex to where we add LightPower Attribute on the firefly and animate the lightPower from 0 - 100 and add tweening styles as-well.
and a system could probably get this LightPower Attribute to compare between fireflies to which who are brighter overtime and so on.
and maybe at the end of the animation we remove the FireflyEffect Tag because it was about to fade out or something so it does not get included when fetching the closest firefly.
Hopefully you get the gist of it! there are many more use cases doing this way and it makes architecting the game easier.