What is the best method of handling scripts that are duplicated?

I have a door and hallway they’ll use the same scripts over and over again. My question is what is the best method of handling them? I don’t want individual scripts per door or tunnel I just want it so if I make a change to one script it would make the change to all scripts.
What comes to mind first is LinkedSource and yes, they can be good for this situation but I was wondering are their any other methods?
Methods I thought up of:
A) Have 1 central script manage all the doors. Will require you to put in the directory for each door. (Time-consuming)
B) Have a script inside the door call a module function that will activate within the script.
C) Combine A and B together. Make a module that will add a value object value to the main controller script. The main controller script will update itself each time a new value is changed. Example: A script calls the module to add this model to the list. The module scripts will do a security check and add the model to the list. The main script will detect that a change was made and refresh the for i,v ipairs part. Once the module yield finishes once it adds the model to the list it the script will delete itself.

What would be the best method? I want it to be as best for game performance as possible but easy for me to add something to the list? I was thinking C but I’m not excactly sure.

Use CollectionService and Tag Editor. You can use one main script and as long as you have the objects tagged properly it works great.

3 Likes

I’ll look into this. My question is. Is it secure? It seems like the client and modify the tags but it will only be on the client side tho. This might be a problem for my games.

I don’t see how this is a problem exaclty? They could just ignore or mess with whatever you’re trying to do by some other method.

The client can do anything they want on the client side. There’s no way to prevent that, it’s simply fact. The problem comes in when the client can do whatever they want on the client and the server, which is what FilteringEnabled prevents for the most part, besides some exceptions.

3 Likes

I’m just worried if a client deletes some tags but I create the tags on the server so I should be good.

Like I said, the client can do anything on the client but it won’t replicate to the server (with a few exceptions). If the client wants to break their own game, let them. As long as you are handling everything important on the server you should be fine and it won’t affect anyone else.

1 Like

Yea, my server handles door opening. There is no client control in door opening.

1 Like

You should be fine then, as long as the client has no control over the server.