Hello guys, i know nothing about scripting and i also got the same problem
bindKey("aim_weapon","both",function(key,state)
local weapon=getPedWeapon(localPlayer)
if weapon==34 then
local objs=getElementsByType("object",root,true)
for i,obj in ipairs(objs) do
if isElementAttachedToBone(obj) then
local alpha=getElementAlpha(obj)
if alpha==0 and state=="up" then
setElementAlpha(obj,255)
elseif alpha==255 and state=="down" then
setElementAlpha(obj,0)
end
end
end
end
end)