#Attachment System Idea

1 messages · Page 1 of 1 (latest)

tropic haven
#

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
ancient chasm
#

or not ""

tropic haven
#

from other players which can have different builds

ancient chasm
#

it could be just one attribute, one StringValue instance

#

even checking if the folder has a child

tropic haven
ancient chasm
tropic haven
#

to add what, an attachment or attribute

ancient chasm
#

attachment

tropic haven
#

nope

hollow ivy
tropic haven
#

well

#

nevermind

#

i guess

#

because

#

the name would matter to see if it can even go on the weapon in the first place

ancient chasm
tropic haven
#

man fuck

ancient chasm
#

tbh ye just checking if there is a child inside of folders would do the trick too

tropic haven
#

this is true

ancient chasm
#

and you could even use their names as indicators of the attachement

#

there is many ways you could go about this

#

just don't go thinking about it too long

#

and start working on it you feel me

tropic haven
#

thats true

#

shit ill just go with the flow

#

thanks man

ancient chasm
#

No problemo amigo keep up the good work