How would I go making a modular framework like this?

Heya Everyone!!

I’m trying to make a tool framework but I’m stuck on what to do next. How I’m planning on making the framework work is that whenever a player has an item equipped, a LocalScript will activate a function within a ModuleScript it has required to create the stats of the gun the player is currently holding.

Of course, the LocalScript also contains the code for actually firing the gun, reloading, and so on. Additionally, all weapons (Which keep in mind are tools not models) have a module script inside of them called Settings which, of course, contains the settings of the guns.
As I stated earlier, the issue is that I don’t really know how to do so. How would I go by doing it?

InputController (LocalScript)

--[[SERVICES]]--
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--[[FOLDERS]]--
local ClientModules = ReplicatedStorage:WaitForChild("ClientModules")
local RemoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")
local Weaponry = ReplicatedStorage:WaitForChild("Weaponry")

--[[MODULES]]--
local BaseGun = require(ReplicatedStorage.ClientModules.BaseGun)

--[[CONTROLS]]--

BaseGun (Module Script)

--[[SERVICES]]--
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--[[MODULE]]--
local BaseGunModule = {}
BaseGunModule.__index = BaseGunModule

function BaseGunModule:New(Weapon)
	local self = setmetatable({}, BaseGunModule)
	
	return self
end

function BaseGunModule:Equip()
	--//TBA
end

function BaseGunModule:Fire()
	--//TBA
end

function BaseGunModule:Reload()
	--//TBA
end

return BaseGunModule

Settings (Module Script, inside of a tool)

local WeaponSettings = { --//Making a slow firing but heavy damaging revolver.
	BaseDamage = 35,
	MinimumDamage = 15,
	MaxiumumDamage = 150,
	AmmoHold = 6,
	AmmoContain = 72,
	BulletSpread = 0.5
}

return WeaponSettings

Since the message is removed, I’ll repurpose this so I’ll show you the framework

1 Like

Bump 1
Bump 1
Bump 1
Bump 1
Bump 1

I don’t understand what’s the question/issue here? From what you’ve described in your post so far, it seems you’ve got it all pretty figured out.

Yeah I’ve already made a decent-ish modular framework with a bit of inspiration from EgoMoose’s FPS framework.

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