Randomiser Attack System Question

im making a game similar to item asylum but im not sure how they handle their items such that it works with damage multipliers and damage indicators. Do they use a server script for each tool? If so, wouldnt it be unoptimised?

no they use tables:

but for random they coming for each object in table, you can have chance with math.random() its choosing random numbers from first to second

Do they handle each item in a module script or is every item in a module?

As in how the item works, like damaging etc.

part.touched:Connect(function(hit)
if  hit parent == humanoid then
humanoid.Health -= 25
end
end)

like this. This work its not full its example to understand

I’m pretty sure IA uses different scripts for each tool (could be a server script, could be a module script. idk), I can’t think of any other way that would work for a game like that since every tool has different abilities, stats, etc.

I think you can just add a folder with the stats to each character (like Attack multiplier) and the tools could get that value and use it.

As for damage indicators, I’m not sure about that one. There might be a tutorial on that.

Ah… I see. I might try to optimise it further so 30+ scripts wont run at once

I must admit I’m not familiar with the game in question. But recently I have been programming a combat system with a lot of different weapons. For my specific structure all the weapons actually get built out of a well defined structure and thereby only have a single script that all weapons share. This however is not necessarily the best way to do it. I like it because it means all of my code for one weapon will update all the weapons which helpse keep everything up to speed, but sometimes spreading out scripts is easier. Like we intend to add ranged weapons which my system as it stands flat out can’t handle so I’ll have to build up a twin to the melee system if I want to group the behaviors again to remove scripting from developing ranged weapons like I did melee.

As for damage to work with multipliers and whatever, all of that gets funneled through a single script too, though with design external scripts can trigger it.

I will note that the amount of scripts running is generally negligible. To achieve the same effect you likely are spawning multiple tasks or otherwise getting some form of asynchronous functionality. This means that Roblox basically has to treat a single script as many anyways and so there is really no optimization from simply combining scripts. You need to specifically reduce the work that each task is doing rather than simply combine them

The reason why I tend to avoid a lot of scripts isn’t for performance but for ease of updating.

How can this be executed? Do you use modules and if so, how do you require them?

I have a weapon system where it uses a combination of modules, client scripts, and server scripts, and I have a module script where its pretty much a dictionary that defines all the other modules for the weapons and it only activates that module when the player has that weapon equipped in their primary or secondary slot through a client script. From there it connects to the server when it needs to harm another player or something through remote events. Its really easy to connect to the currently equipped weapon as you can just match the names up through the table.