:Clone() scripts = bad?

So the system i use right now is: [make a single script for to be used in every weapon, copy this script and put it into every weapon thats in the ServerStorage so then i wont have to keep cloning them]

Is this a bad technique? is there any downside to cloning the same script into everything?

And if this strategy is bad then how would i learn and use module scripts to do the same thing. (because last time i worked with them they didnt like me for the locals etc)

So basically im asking if: cloning scripts = bad and if it is bad how do i effectively use module scripts in the same way.

I don’t think this is a bad technique, but why not just leave the script inside of the weapon.

Cloning isn’t bad it’s just impractical. I recommend looking into:
https://developer.roblox.com/en-us/api-reference/class/CollectionService

Also using this plugin would make it 3x easier:

Makes things easier

so i can update everything at the same time also ive put every weapon function into this script that gets cloned

It is not impractical for what he is doing it for.

In that case cloning the weapon script is completely ok, you do not need to use a module script.

The con with cloning is that it uses up your server data and network connection.
making it run slower

This is not true, where did you get this information from?

1 Like

this is what im wondering rn (i havnt had any signs or anything i just want to make the right decision) also how much of an effect would this have if it is the case?

The collection service is mainly useful when you want to group items into specific categories so you can then reference them easier in your scripts without having to depend on a hierarchical structure.

You don’t even need to use modules. You can use a single script to manage every gun. Whenever a player equips the gun or whatever, that script can handle the gun.

I’d recommend that approach

1 Like

What do you mean, why dont you Clone 150 scripts into your game, Press “Shift+f5” and look at the recieve…

well basically what im wondering is if having the same big script in everything (everything meaning JUST the weapons) is bad for performance or not because its very easy for me to do and ive worked like this for a while now

Isn’t that basically what i was saying with Collection service

To be honest, I don’t think :Clone() scripts are bad.

so this would be about probably at most 80 of these ingame

No it is not please stop spreading misinformation @isaiahbur there is nothing wrong with your current implementation, some people may go the modular route but your doing it just fine.

It’s just unorganized and you create a lot of instances if you clone a lot of scripts.

I overall don’t recommend it at all and module scripts aren’t necessarily the solution but can be.

You can use CollectionService for the most part.

It’ll only become inefficient when you start using it to make too many scripts.

They aren’t “bad” but they aren’t very ideal especially if you are running a fairly heavy server and the gun’s script is duplicated so many times for each player.

that’s what i mean by impracticality

well the thing is im only using one script for tools and just cloning this script into all the tools in the storage upon the game starting. so its very organized im just wondering about performance.