I have recently started making a Attachment system for guns, and I have come across a problem I don’t know how to solve.
I am not too familliar with GUIs, I am wondering of something like this is possible? for the Billboard UIs to move around like that.
How I want the Attachment UI/Billboard UIs to function (video)
^attachment system from a game: Escape From Tarkov
I want the billboard UIs to move around the weapon model like that, and also to have a line connecting two, I was thinking of adding Beams and Attachments, instead of Billboard UIs appearing where Attachment slot are, It could clone the Attachment Slot and move the clone around weapon model where the billboard UI will be adorneed to and also have beam and Attachment.
This is what I managed to make so far, if there is any confusion with my text you can always tell me or ask me to elaborate.
local function SearchFunction(GunModTable:{},AttachNumber)
for Slot,AttachmentData in GunModTable do
if AttachmentData.Name ~= "" then
local Attachment = game.ReplicatedStorage.ACS_Engine.GunMods:FindFirstChild(AttachmentData.Type):FindFirstChild(AttachmentData.Name):Clone()
Attachment.Parent = weapon
local Test = string.gsub(AttachmentData.Node, "%a+", "")
Attachment.Name = Attachment.Name.."Attachment"..Test
local LookIn
if AttachmentData.AttachedTo == "weapon" then
Attachment:PivotTo(weapon.Nodes[AttachmentData.Node].CFrame)
LookIn = weapon
else
if type(AttachNumber) == "string" and not string.find(AttachmentData.AttachedTo,"Attachment") then
AttachmentData.AttachedTo = AttachmentData.AttachedTo..AttachNumber
end
Attachment:PivotTo(weapon[AttachmentData.AttachedTo].Nodes[AttachmentData.Node].CFrame)
LookIn = weapon:FindFirstChild(Attachment.Name)
end
if LookIn:FindFirstChild("Nodes") then
for _,Nodes in pairs(LookIn:FindFirstChild("Nodes"):GetChildren()) do
local BillboardUI = script.GunMod.BillboardGui:Clone()
BillboardUI.Parent = Player.PlayerGui.BillboardGuis
BillboardUI.Adornee = Nodes
BillboardUI.Name = AttachmentData.AttachedTo..": "..AttachmentData.Name
end
end
end
if AttachmentData.Attachments then
local AttachNumber
if AttachmentData.Node then
AttachNumber = AttachmentData.Node.gsub(AttachmentData.Node, "%a+", "Attachment")
end
SearchFunction(AttachmentData.Attachments,AttachNumber)
end
end
end
SearchFunction(ACS_Module.Attachments)
^script I made for the billboard buttons.
Attachments = {
GasBlock = {
Name = "AKS-74U gas tube",
Type = "Gasblock",
Compatible = "Gasblock",
AttachedTo = "weapon",
Node = "Gasblock",
Required = true,
Attachments = {
Handguard = {
Name = "AKS-74U Alfa Arms Goliaf handguard",--"AKS-74U wooden handguard",
Type = "Handguard",
Compatible = "Handguard",
AttachedTo = "AKS-74U gas tube",
Node = "Handguard",
Required = true,
Attachments = {
Scope = {
Name = "EOTech EXPS3 holographic sight (Tan)",
Type = "Scope",
Compatible = "Scope",
AttachedTo = "AKS-74U Alfa Arms Goliaf handguard",
Node = "Scope",
},
Foregrip = {
Name = "",
Type = "",
Compatible = "Foregrip",
AttachedTo = "AKS-74U Alfa Arms Goliaf handguard",
Node = "Foregrip",
},
Tactical = {
Name = "",
Type = "",
Compatible = "Tactical Devices",
AttachedTo = "AKS-74U Alfa Arms Goliaf handguard",
Node = "Tactical",
},
Tactical1 = {
Name = "",
Type = "",
Compatible = "Tactical Devices",
AttachedTo = "AKS-74U Alfa Arms Goliaf handguard",
Node = "Tactical1",
},
Tactical2 = {
Name = "",
Type = "",
Compatible = "Tactical Devices",
AttachedTo = "AKS-74U Alfa Arms Goliaf handguard",
Node = "Tactical2",
},
Tactical3 = {
Name = "",
Type = "",
Compatible = "Tactical Devices",
AttachedTo = "AKS-74U Alfa Arms Goliaf handguard",
Node = "Tactical3",
},
}
},
}
},
Muzzle = {
Name = "AKS-74U 5.45x39 muzzle brake",
Type = "Muzzle",
Compatible = "Muzzle",
AttachedTo = "weapon",
Node = "Muzzle",
},
Reciever = {
Name = "AKS-74U dust cover",
Type = "Reciever",
Compatible = "Reciever",
AttachedTo = "weapon",
Node = "Reciever",
Attachments = {
Mount = {
Name = "",--"AKS-74U wooden handguard",
Type = "",
Compatible = "Mount",
AttachedTo = "AKS-74U dust cover",
Node = "Mount",
},
}
},
};
^what AttachmentSettings/Data
looks like