I think I have created the most inefficient er, well at least most grinding way to make weapon attachments ever. I have a different gun each with a different attachment, currently only 3 guns. But all I want is a faster way to do this script like more organized or something. What I have are 3 buttons, two attachments and a gun. I also have two text labels that show what you pressed. The buttons change the text in the text labels, this script looks for the names to determine what gun to give. Well here is the code, I was wondering if there was a faster way to check or more efficient or somethng lol I don't even know:
local gun = script.Parent.Parent.Selected
local ment = script.Parent.Parent.Attach
local ACR = game.ReplicatedStorage.Weapons.ACR
local ACRA = game.ReplicatedStorage.Weapons.ACRAcog
local ACRR = game.ReplicatedStorage.Weapons.ACRDot
local Aclone = ACR:Clone()
local AAclone = ACRA:Clone()
local ADclone = ACRR:Clone()
local player = game.Players.LocalPlayer
local gui = script.Parent.Parent
function onClicked()
if gun.Text == "ACR" then
if ment.Text == "None" then
Aclone.Parent = player.Backpack
gui:Destroy()
elseif ment.Text == "Acog" then
AAclone.Parent = player.Backpack
gui:Destroy()
elseif ment.Text == "Red Dot" then
ADclone.Parent = player.Backpack
gui:Destroy()
end
end
end
script.Parent.MouseButton1Down:connect(onClicked)
As you see, it sucks lol a different variable for each gun and the clone. Just wondering if there was a faster and better way to do all of this. Any help is greatly appreciated :)
