Replicating same script for many copies of the same object

  1. What do you want to achieve?
    I want an easy way to edit a script used across many copies of the same object.
  2. What is the issue?
    I have a copy of the script in every. single. object. of the same type, and I recently had the epiphany “hey maybe this isnt a great idea”
  3. What solutions have you thought of so far?
    I’ve looked into ModuleScripts and CollectionService, but both seem confusing and not really what I’m looking for.

In case you’re wondering, my specific application is a facility type game, with lights that change colors and nearly identical doors.

You don’t necessarily have to work with collection service, but for your implication it may help. You could tag all applicable lights, get them using :GetTagged() and change the properties of the returned lights.

Same thing with doors, if they are practically identical then they must open the same way, get the tagged doors and effect which door the player interacts with.

You can also have special functions for certain doors depending on the tag of the door. Setting up your game to easily add functionality should be a priority.


CollectionService would probably be the ideal solution for the lights, just tag each neon part and boom

For the doors I might just make a system that clones the script into the door by default, but allows you to override for individual doors to add more functionality