RTS Unit System

Hello, i’m making an Real Time Strategy Game in Roblox Studio and i have encountered a problem. I’m not sure what’s the best way to make my units more customizable and add different functionalities.

For example, i want a “Sniper” unit to shoot normally with a high range but i want another unit that explodes nearby enemies with different customized visual effects when shot

I have thought of creating a default unit script that would get added to the unit model when it’s created but if i did that there wouldnt be any way to customize it. I have also thought of using inherited OOP classes but i’m not sure how to do it

Any help is appreciated, thanks!

I’d use modules to create a base unit system which controllers timing for actions (shooting / reloading whatever aswell as targeting and whatnot) and add special callbacks for said functions. I would also initialize said module with a “settings” table, and some functions which allow for customization.

-- pseudocode
local Unit = UnitBaseModule.new({settings})

Unit:SetCallback("Attack",function() -- or just a Unit.OnAttack = function()
    print("attacking")
end)

Although I never developed such game so take this with a grain of salt