guntype=1 weldmode=1 model=nil distance=.75 rotation=135 y=2 x=-0.75 parts={}local s=1 function on(N)if model==nil then s=1 local N=Instance.new("\077\111\100\101\108")local g=script.Parent:GetChildren()for b=1,#g,1 do if g[b].className=="\080\097\114\116"then parts[s]=g[b].Transparency local I=g[b]:clone()I.Parent=N s=s+1 end end wait()if model==nil then local s=script:FindFirstChild("\087\101\108\100\050")if s~=nil then local g=s:clone()g.Disabled=false g.Parent=N N.Name=script.Parent.Name N.Parent=script.Parent.Parent model=N local b=model:FindFirstChild("\072\097\110\100\108\101")if b~=nil then if guntype==1 then local s=model.Parent:FindFirstChild("\084\111\114\115\111")if s~=nil then if weldmode==1 then local N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.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 N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.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 N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.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 N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.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 s=model.Parent:FindFirstChild("\084\111\114\115\111")if s~=nil then if weldmode==1 then local N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.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 N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.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 N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.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 N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.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 s=model.Parent:FindFirstChild("\076\101\102\116 \076\101\103")local N=model.Parent:FindFirstChild("\082\105\103\104\116 \076\101\103")if s~=nil and N~=nil then if weldmode==1 then local s=Instance.new("\087\101\108\100")s.Part0=N s.Parent=s.Part0 s.Part1=b s.C1=CFrame.new(distance*-1,0+y,-0.25+x*-1)*CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)elseif weldmode==2 then local N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.C1=CFrame.new(distance,0+y,-0.25+x*-1)*CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)elseif weldmode==3 then local s=Instance.new("\087\101\108\100")s.Part0=torso s.Parent=s.Part0 s.Part1=b s.C1=CFrame.new(distance*-1,0+y,.25+x)*CFrame.fromEulerAnglesXYZ(math.pi/2,math.pi/2,0)elseif weldmode==4 then local s=Instance.new("\087\101\108\100")s.Part0=torso s.Parent=s.Part0 s.Part1=b s.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 s=model.Parent:FindFirstChild("\076\101\102\116 \076\101\103")local N=model.Parent:FindFirstChild("\082\105\103\104\116 \076\101\103")local g=model.Parent:FindFirstChild("\084\111\114\115\111")if s~=nil and(N~=nil and g~=nil)then if weldmode==1 then local s=Instance.new("\087\101\108\100")s.Part0=N s.Parent=s.Part0 s.Part1=b s.C1=CFrame.new(distance*-1,.15+y,-0.25+x*-1)*CFrame.fromEulerAnglesXYZ(math.pi,0,0)elseif weldmode==2 then local N=Instance.new("\087\101\108\100")N.Part0=s N.Parent=N.Part0 N.Part1=b N.C1=CFrame.new(distance,.15+y,-0.25+x*-1)*CFrame.fromEulerAnglesXYZ(math.pi,0,0)elseif weldmode==3 then local s=Instance.new("\087\101\108\100")s.Part0=g s.Parent=s.Part0 s.Part1=b s.C1=CFrame.new(distance*-1,0+y,.25+x)*CFrame.fromEulerAnglesXYZ(math.pi,math.pi/2,0)elseif weldmode==4 then local s=Instance.new("\087\101\108\100")s.Part0=g s.Parent=s.Part0 s.Part1=b s.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 s=1 local N=model:GetChildren()for s=1,#N,1 do if N[s].className=="\080\097\114\116"then N[s].Transparency=1 end end end end function off(N)if model~=nil then s=1 local N=model:GetChildren()for g=1,#N,1 do if N[g].className=="\080\097\114\116"then N[g].Transparency=parts[s]local b=true if b then b=false s=s+1 end end end end end script.Parent.Equipped:connect(on)script.Parent.Unequipped:connect(off)
--to use: put in type of gun: barrel point left, barrel point right or bull-pup(main hande is in the middle of the gun)
--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 = -0.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)
