Like I said in the title im using all the combat functions in 1 module script like this:
But I dont really know if thats a good idea or if it’s goig to lag the game
I saw a post that said that we should be using module scripts with only functions interrelated so idk what to do
It really depends how you want to organise your scripts and what type of future proofing you are looking for.
Simply having your combat in one module script is unlikely to be a primary cause of lag. But you might want to consider how many lines of code this combat system will use. Because it could become more difficult to maintain as it grows.
Depending on how you do things I personally would choose to split it further for example:
You might have many different connected systems such as:
A local function for a more acurated wait function
Hitbox creation and hit detection
Hit calculations like if the hit was a parry or if the player is stunned
A function to add stun and other effects(like hyper armor)
A function to add the actual StatusEffects like fire or poison with the right effects
Knockback function
Damage calculation like damage type, hit vfx, status effect, etc
And the cooldown function
I have the vfx replication function in another module that sends the info to every client in a radious to avoid lag but I think I should do that with the cooldown function and the add function too