I want to know if this is a sane approach. So you have these node parts and preset them. I have a script structure like this so far and I wanna get some thoughts.
local attachment = {}
attachment.__index = attachment
function attachment.new(tool:Tool)
local self = setmetatable({}, attachment)
self.viewmodel = game.Workspace.CurrentCamera:WaitForChild(tool.Name .. "_Viewmodel")
local modsPath = self.viewmodel:WaitForChild("Nodes"):WaitForChild("weapon_mods")
self.optic = modsPath:WaitForChild("optic")
self.grip = modsPath:WaitForChild("grip")
self.muzzle = modsPath:WaitForChild("muzzle")
self.tactical = modsPath:WaitForChild("tactical")
self.hasGrip = self.viewmodel:GetAttribute("hasGrip")
self.hasMuzzle = self.viewmodel:GetAttribute("hasMuzzle")
self.hasOptic = self.viewmodel:GetAttribute("hasOptic")
self.hasTactical = self.viewmodel:GetAttribute("hasTactical")
return self
end
function attachment:onEquip()
local optic:Model = self.optic:FindFirstChildOfClass("Model")
--add rest of crap here
for _, child:Instance in pairs(optic:GetChildren()) do
if child and child.Name ~= "aimPartOptic" then
print(child.Name)
end
end
end
function attachment:aimPriority()
end
function attachment:checkChange(attnameSignal)
end
function attachment:addOn(attNameSignal)
end
function attachment:remove(attNameSignal)
end
return attachment