One big module or multiple for Weapons?

(Tools / Attributes)

My normal process

Tool > FireServer:

Remote.OnServerEvent:Connect(function(Player)
 -- Call the modulescript which does the combo and hitbox stuff
end)

(Module script gets the player’s combo and weapon attribute then gets the weapon data from another module script which holds the damage, Hitbox size, etc. Does everything with that stuff. Comment if I need more details)

I’m wondering if I should stick to what I’m doing and have one big module script handle everything from combo changing and hitbox spawning, or should I make separate modules for EACH weapon in the game (would this be unnecessary and take up memory?).

Normally I have one big module (big is a exaggerated) that handles combo’s and how much damage it should do and whatnot. But I kind of feel like just making separate module scripts would serve the same purpose while allowing for more customization options like if I wanted each swing to do status effects or something.

Can someone tell me how they normally do it, how I can improve mine, or if better methods exist?

1 Like

Personal preference, but I have one big module for weapons.

The module holds the basic settings of the weapons like damage, combos, even special unique functions that the weapon may contain.

I do feel like this is easier to manage and if I need any information about the weapon, I just do:

local Weapons = require(ReplicatedStorage.Weapons);

print(Weapons["Barefist"].BasicDMG) -- output: 10

Now, this works like a charm for me, but once again it’s all personal preference.

2 Likes

For the special function would this be how you call it? Would this be right:

local Weapons = require(ReplicatedStorage.Weapons);

if Weapons.Special ~= nil then
 Weapons.Special
end 

Yep, I do something like that:

if Weapons[weapon].Special then
	Weapons[weapon].Special(plr, humanoid);
end

It’s really fun to play around with.

1 Like

That’s a really good method, if no one else comments I’m gonna mark you as the solution. Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.