guntype=1 weldmode=1 model=nil distance=.75 rotation=135 y=2 x=-0.75 parts={}local n=1 function on(P)if model==nil then n=1 local P=Instance.new("\077\111\100\101\108")local r=script.Parent:GetChildren()for x=1,#r,1 do if r[x].className=="\080\097\114\116"then parts[n]=r[x].Transparency local N=r[x]:clone()N.Parent=P n=n+1 end end wait()if model==nil then local n=script:FindFirstChild("\087\101\108\100\050")if n~=nil then local r=n:clone()r.Disabled=false r.Parent=P P.Name=script.Parent.Name P.Parent=script.Parent.Parent model=P local N=model:FindFirstChild("\072\097\110\100\108\101")if N~=nil then if guntype==1 then local n=model.Parent:FindFirstChild("\084\111\114\115\111")if n~=nil then if weldmode==1 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance*-1,.25+y,-0.75+x*-1)*CFrame.fromEulerAnglesXYZ(math.rad(rotation*-1),math.pi/2,0)elseif weldmode==2 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance,.25+y,-0.75+x*-1)*CFrame.fromEulerAnglesXYZ(math.rad(rotation*-1),(math.pi/2)*-1,0)elseif weldmode==3 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance*-1,-0.1+y,.2+x*-1)*CFrame.fromEulerAnglesXYZ(math.rad(rotation),math.pi/2,-1.5)elseif weldmode==4 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance,.25+y,-0.75+x*-1)*CFrame.fromEulerAnglesXYZ(math.rad(rotation),(math.pi/2+rotation)*-1.1,1)end end elseif guntype==2 then local n=model.Parent:FindFirstChild("\084\111\114\115\111")if n~=nil then if weldmode==1 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance*-1,.25+y,-0.5+x*-1)*CFrame.fromEulerAnglesXYZ(math.rad(rotation*-1),math.pi/2,0)elseif weldmode==2 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance,.25+y,-0.5+x*-1)*CFrame.fromEulerAnglesXYZ(math.rad(rotation*-1),(math.pi/2)*-1,0)elseif weldmode==3 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance*-1,.25+y,-0.5+x*-1)*CFrame.fromEulerAnglesXYZ(math.rad(rotation),math.pi/2,0)elseif weldmode==4 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance,.25+y,-0.5+x*-1)*CFrame.fromEulerAnglesXYZ(math.rad(rotation),(math.pi/2)*-1,0)end end elseif guntype==3 then local n=model.Parent:FindFirstChild("\076\101\102\116 \076\101\103")local P=model.Parent:FindFirstChild("\082\105\103\104\116 \076\101\103")if n~=nil and P~=nil then if weldmode==1 then local n=Instance.new("\087\101\108\100")n.Part0=P n.Parent=n.Part0 n.Part1=N n.C1=CFrame.new(distance*-1,0+y,-0.25+x*-1)*CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)elseif weldmode==2 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance,0+y,-0.25+x*-1)*CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)elseif weldmode==3 then local n=Instance.new("\087\101\108\100")n.Part0=torso n.Parent=n.Part0 n.Part1=N n.C1=CFrame.new(distance*-1,0+y,.25+x)*CFrame.fromEulerAnglesXYZ(math.pi/2,math.pi/2,0)elseif weldmode==4 then local n=Instance.new("\087\101\108\100")n.Part0=torso n.Parent=n.Part0 n.Part1=N n.C1=CFrame.new(distance,0+y,.25+x)*CFrame.fromEulerAnglesXYZ(math.pi/2,(math.pi/2)*-1,0)end end elseif guntype==4 then local n=model.Parent:FindFirstChild("\076\101\102\116 \076\101\103")local P=model.Parent:FindFirstChild("\082\105\103\104\116 \076\101\103")local r=model.Parent:FindFirstChild("\084\111\114\115\111")if n~=nil and(P~=nil and r~=nil)then if weldmode==1 then local n=Instance.new("\087\101\108\100")n.Part0=P n.Parent=n.Part0 n.Part1=N n.C1=CFrame.new(distance*-1,.15+y,-0.25+x*-1)*CFrame.fromEulerAnglesXYZ(math.pi,0,0)elseif weldmode==2 then local P=Instance.new("\087\101\108\100")P.Part0=n P.Parent=P.Part0 P.Part1=N P.C1=CFrame.new(distance,.15+y,-0.25+x*-1)*CFrame.fromEulerAnglesXYZ(math.pi,0,0)elseif weldmode==3 then local n=Instance.new("\087\101\108\100")n.Part0=r n.Parent=n.Part0 n.Part1=N n.C1=CFrame.new(distance*-1,0+y,.25+x)*CFrame.fromEulerAnglesXYZ(math.pi,math.pi/2,0)elseif weldmode==4 then local n=Instance.new("\087\101\108\100")n.Part0=r n.Parent=n.Part0 n.Part1=N n.C1=CFrame.new(distance,0+y,.25+x)*CFrame.fromEulerAnglesXYZ(math.pi,(math.pi/2)*-1,0)end end end end end end end if model~=nil then n=1 local P=model:GetChildren()for n=1,#P,1 do if P[n].className=="\080\097\114\116"then P[n].Transparency=1 end end end end function off(P)if model~=nil then n=1 local P=model:GetChildren()for x=1,#P,1 do if P[x].className=="\080\097\114\116"then P[x].Transparency=parts[n]local r=true if r then r=false n=n+1 end end end end end script.Parent.Equipped:connect(on)script.Parent.Unequipped:connect(off)

                                  --step 2: put in what type of wepoan it is: assult rifle or pistol(there will be more)
guntype = 1               --1 is assult rifle, 2 is bullpup, 3 is pistol, 4 is knife
weldmode = 1            --1 is barrel point upper-left, 2 is barrel pointing upper-right, 3 is barrel point lower-left and 4 is barrel point lower-right
                                  -------(note: if it is pistol or knife then 1 is on right leg, 2 is on left leg, 3 is in the back of your pants and 4 is in the front of your pants)
model = nil                 --gun model, that is
distance = 0.75          --this is the distance between the part(torso/leg) and the gun. DON'T MAKE negitive
rotation = 135              --this is the turning in degrees.
                                   --this area is mode more for someone who's already good at gun's. please do not get mad at me if you don't understand what's under here
y = 2                           --this is what's added to the current y value. positive number's make it go down. negative make's it go up
 x = -.75                          --this is what's added to the x value(it's really the z value but it look's like the x value when on your back). positive number's make it go left. negative make's it go right

parts = {}
local n = 1

function on(mouse)
if model == nil then
n = 1
local m = Instance.new("Model")
local all = script.Parent:GetChildren()
for i = 1, #all do
if all[i].className == "Part" then
parts[n] = all[i].Transparency
local brick = all[i]:clone()
brick.Parent = m
n = n +1
end
end
wait()
if model == nil then
local weld = script:FindFirstChild("Weld2")
if weld ~= nil then
local new = weld:clone()
new.Disabled = false
new.Parent = m
m.Name = script.Parent.Name
m.Parent = script.Parent.Parent
model = m
local handle = model:FindFirstChild("Handle")
if handle ~= nil then


if guntype == 1 then
local torso = model.Parent:FindFirstChild("Torso")
if torso ~= nil then
if weldmode == 1 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.25 +y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), (math.pi / 2), 0)
elseif weldmode == 2 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25 +y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), (math.pi / 2 ) *-1, 0)
elseif weldmode == 3 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, -0.1+y, 0.2 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), (math.pi / 2), -1.5)
elseif weldmode == 4 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25+y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), (math.pi / 2 +rotation) *-1.1, 1)
end
end




elseif guntype == 2 then
local torso = model.Parent:FindFirstChild("Torso")
if torso ~= nil then
if weldmode == 1 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.25+y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2, 0)
elseif weldmode == 2 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2 *-1, 0)
elseif weldmode == 3 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2, 0)
elseif weldmode == 4 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2 *-1, 0)
end
end




elseif guntype == 3 then
local lleg = model.Parent:FindFirstChild("Left Leg")
local rleg = model.Parent:FindFirstChild("Right Leg")
if lleg ~= nil and rleg ~= nil then
if weldmode == 1 then
local w = Instance.new("Weld")
w.Part0 = rleg
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
elseif weldmode == 2 then
local w = Instance.new("Weld")
w.Part0 = lleg
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
elseif weldmode == 3 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi / 2 , math.pi / 2, 0)
elseif weldmode == 4 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi / 2 , math.pi / 2 *-1, 0)
end
end




elseif guntype == 4 then
local lleg = model.Parent:FindFirstChild("Left Leg")
local rleg = model.Parent:FindFirstChild("Right Leg")
local torso = model.Parent:FindFirstChild("Torso")
if lleg ~= nil and rleg ~= nil and torso ~= nil then
if weldmode == 1 then
local w = Instance.new("Weld")
w.Part0 = rleg
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.15 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi, 0, 0)
elseif weldmode == 2 then
local w = Instance.new("Weld")
w.Part0 = lleg
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.15 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi, 0, 0)
elseif weldmode == 3 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi , math.pi / 2, 0)
elseif weldmode == 4 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi , math.pi / 2 *-1, 0)
end
end
end
end
end
end
end




if model ~= nil then
n = 1
local all = model:GetChildren()
for i = 1, #all do
if all[i].className == "Part" then
all[i].Transparency = 1
end
end
end
end

function off(mouse)
if model ~= nil then
n = 1
local all = model:GetChildren()
for i = 1, #all do
if all[i].className == "Part" then
all[i].Transparency = parts[n]
local Do = true
if Do then
Do = false
n = n +1
end
end
end
end
end

script.Parent.Equipped:connect(on)
script.Parent.Unequipped:connect(off)
