How would I use this simple gun module script when scripting guns for my game?

Heya There!!

I’ve made this simple gun module that handles core mechanics of guns such as firing and reloading. The issue is that I’m struggling on finding a way to make guns with the module system implemented in. Should I have a script in ServerScriptService that detects if a player has an item equipped and is using it or something else?

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

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

function BaseGunModule:CreateGunStats(Damage, Firerate, Range, AmmoHold, AmmoContain)
	local self = setmetatable({}, BaseGunModule)
	
	self.Damage = Damage
	self.Firerate = Firerate
	self.Range  = Range
	self.AmmoHold = AmmoHold
	self.AmmoContain = AmmoContain
	
	--//Adding weapon functions
	self:Equip()
	self:OnUse()
	
	return self
end

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

function BaseGunModule:OnUse()
	if self.AmmoHold >= 0 then
		self:Fire()
	else
		self:Reload()
	end
end

--//Firing & Reloading
function BaseGunModule:Fire(A, B) --//A is where the shot is first positioned. B is wherever the shot hits at.
	local NewRaycast = workspace:Raycast(A, B * self.Range)
	local RaycastInstance = NewRaycast.Instance
	if RaycastInstance then
		
		--//Finding to see if whatever we hit had a humanoid in it.
		local Humanoid = RaycastInstance.Parent:FindFirstChildWhichIsA("Humanoid")
		if not Humanoid then
			return
		end
		
		if Humanoid.Health >= 0 then
			Humanoid:TakeDamage(self.Damage)
			print(RaycastInstance.Parent.." has taken "..self.Damage.."!")
		end
	end
end

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

return BaseGunModule

I’ll go bump this post real quick, there ya go.

I don’t really get the question, but I noticed that when you did self:Fire() you put no args insidd when it expects A & B.

I’ll be completely honest with you, yeah I was half-asleep when writing the question down. Anyway, what I’m basically saying is how would I use the module script when scripting guns.

EDIT: Nevermind, I get what you said.

I’ll go bump this post again, I suppose.

I would use a local script to detect when someone is shooting/holding a gun, and when it hits someone it signals a remote event that makes the player it hit take damage, if that’s what you’re asking