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