SomeRandomD00D

Untitled

Jul 4th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Smith and Wesson M&P 45, chambered in .45 ACP ammunition.
  3. The standard magazine holds 10 rounds, although magazines that could hold 14 rounds were also made but looked incredibly stupid.
  4. Credit to litozinnamon for the crosshairs and bullethole decals. I used them without permission. Not like I asked him, anyhow.
  5. ]]
  6.  
  7. plr=game:service'Players'.LocalPlayer
  8. ch,char=plr.Character,plr.Character
  9. hum=ch.Humanoid
  10. tor,torso,rootpart,rj=ch.Torso,ch.Torso,ch.HumanoidRootPart,ch.HumanoidRootPart.RootJoint
  11. m,mouse=plr:GetMouse(),plr:GetMouse()
  12. cfn,ang,mr,int=CFrame.new,CFrame.Angles,math.rad,Instance.new
  13. bc=BrickColor.new
  14. head=ch.Head
  15. cam=workspace.CurrentCamera
  16.  
  17. rj.C0=cfn()
  18. rj.C1=cfn()
  19.  
  20. sheathed=false
  21. jammed=false
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. local minimumsize = Vector3.new(0.7,0.7,0.7) --Minimumsize for a part to get divided,higher numbers = less detailed and bigger/less bricks
  34. local surface_between_splitted_parts = 'SmoothNoOutlines' --the surface between splitted parts
  35. --local fragmented = workspace:FindFirstChild("Fragmented")
  36. local fragmentable = workspace --all fragmentable objects should be stored in here
  37. local list = {}
  38. local brickcount = 0
  39. --local m = Instance.new("Hint",workspace)
  40. local storage = {}
  41. local fillup = 1000 --it constantly generates new parts until it reaches this number(hacky way to prevent lagspikes if there is a large explosion),change it to 0 if you don´t want it to generate (useless) parts.
  42. local maximumstorage = 2000 --it will recycle parts if the number of parts in the storage doesnt exceed this number
  43. local storage_position = Vector3.new(0,0,5000) --place them somewhere off the map
  44. local stored_partsize = Vector3.new(1,1,1) --make them small
  45. local parts_created_per_frame = 5 --number of parts being created per frame to fill up the storage
  46.  
  47.  
  48. function fragmentate(cframe,size,color,explosion_position,explosion_blastradius,backsurface,bottomsurface,frontsurface,leftsurface,rightsurface,topsurface,transparency,reflectance)
  49. local xi = size.X >= minimumsize.X*(1+explosion_blastradius/16) and 2 or 1 --to reduce the lagg in large explosions we increase minimumsize based on the explosionradius...
  50. local yi = size.Y >= minimumsize.Y*(1+explosion_blastradius/16) and 2 or 1
  51. local zi = size.Z >= minimumsize.Z*(1+explosion_blastradius/16) and 2 or 1
  52. if xi == 1 and yi == 1 and zi == 1 or (cframe.p-explosion_position).magnitude > size.magnitude/2 + explosion_blastradius then --don´t fragmentate parts, that are too small to fragmentate or too far away from the explosion
  53. if xi == 1 and yi == 1 and zi == 1 then return end --optional
  54. if #storage > 0 then
  55. local p = storage[1]
  56. p.BrickColor = color
  57. p.Size = size
  58. p.BackSurface = backsurface
  59. p.BottomSurface = bottomsurface
  60. p.FrontSurface = frontsurface
  61. p.LeftSurface = leftsurface
  62. p.RightSurface = rightsurface
  63. p.TopSurface = topsurface
  64. p.Transparency = transparency
  65. p.CFrame = cframe
  66. p.Reflectance = reflectance
  67. table.remove(storage,1)
  68. else
  69. local p = Instance.new("Part",fragmentable)
  70. p.BrickColor = color
  71. p.FormFactor = "Custom"
  72. p.Size = size
  73. p.BackSurface = backsurface
  74. p.BottomSurface = bottomsurface
  75. p.FrontSurface = frontsurface
  76. p.LeftSurface = leftsurface
  77. p.RightSurface = rightsurface
  78. p.TopSurface = topsurface
  79. p.Transparency = transparency
  80. if p.Transparency>0.285 then
  81. p.Anchored = false
  82. else
  83. p.Anchored=true
  84. p.Material='Wood'
  85. end
  86. p.CFrame = cframe
  87. p.Reflectance = reflectance
  88. end
  89. --p:MakeJoints()
  90. -- m.Text = m.Text+1
  91. return --stop the function
  92. end
  93. local mody = math.random(-125,125)/1000 --some randomization
  94. for y = 1,yi do
  95. if math.random()> 0.5 then
  96. local modx = math.random(-125,125)/1000
  97. for x = 1,xi do
  98. local modz = math.random(-125,125)/1000
  99. for z = 1,zi do --offset = x/xi-0.75+modx)
  100. fragmentate(cframe*CFrame.new(size.X*(xi==1 and 0 or x/xi-0.75+modx),size.Y*(yi==1 and 0 or y/yi-0.75+mody),size.Z*(zi==1 and 0 or z/zi-0.75+modz)), --maths
  101. Vector3.new(xi == 2 and size.X*(1-2*math.abs(x/xi-0.75+modx)) or size.X,yi == 2 and size.Y*(1-2*math.abs(y/yi-0.75+mody)) or size.Y,
  102. zi == 2 and size.Z*(1-2*math.abs(z/zi-0.75+modz)) or size.Z or agent767_was_here),color,explosion_position,explosion_blastradius,
  103. z~=zi and surface_between_splitted_parts or backsurface,y==2 and surface_between_splitted_parts or bottomsurface,
  104. z==2 and surface_between_splitted_parts or frontsurface,x==2 and surface_between_splitted_parts or leftsurface,x~=xi and surface_between_splitted_parts or rightsurface,
  105. y~=yi and surface_between_splitted_parts or topsurface,transparency,reflectance)
  106. end
  107.  
  108. end
  109. else
  110. local modz = math.random(-125,125)/1000
  111. for z = 1,zi do
  112. local modx = math.random(-125,125)/1000
  113. for x = 1,xi do
  114. fragmentate(cframe*CFrame.new(size.X*(xi==1 and 0 or x/xi-0.75+modx),size.Y*(yi==1 and 0 or y/yi-0.75+mody),size.Z*(zi==1 and 0 or z/zi-0.75+modz)),
  115. Vector3.new(xi == 2 and size.X*(1-2*math.abs(x/xi-0.75+modx)) or size.X,yi == 2 and size.Y*(1-2*math.abs(y/yi-0.75+mody)) or size.Y,
  116. zi == 2 and size.Z*(1-2*math.abs(z/zi-0.75+modz)) or size.Z),color,explosion_position,explosion_blastradius,
  117. z~=zi and surface_between_splitted_parts or backsurface,y==2 and surface_between_splitted_parts or bottomsurface,
  118. z==2 and surface_between_splitted_parts or frontsurface,x==2 and surface_between_splitted_parts or leftsurface,x~=xi and surface_between_splitted_parts or rightsurface,
  119. y~=yi and surface_between_splitted_parts or topsurface,transparency,reflectance)
  120. end
  121. end
  122. end
  123. end
  124. end
  125.  
  126. function start_fragmentation(position,radius)
  127. local search = Region3.new(position-Vector3.new(radius,radius,radius)*1.1,position+Vector3.new(radius,radius,radius)*1.1)
  128. repeat
  129. local finish = false
  130. local parts = workspace:FindPartsInRegion3WithIgnoreList(search,list,100) --maximum number of parts that FindPartsInRegion3 can find is 100, so we have to do this to find them all
  131. for i = 1,#parts do
  132. table.insert(list,1,parts[i])
  133. end
  134. finish = true
  135. until #parts < 100 and finish
  136. print(#list)
  137. local t = tick()
  138. for i = 1,#list do
  139. local p = list[i]
  140. if p:IsDescendantOf(fragmentable) and p:GetMass()<3000 and p.Transparency>0.285 and p.Name~='Base' and p:IsDescendantOf(ch)==false then
  141. fragmentate(p.CFrame,p.Size,p.BrickColor,position,radius,p.BackSurface,p.BottomSurface,p.FrontSurface,p.LeftSurface,p.RightSurface,p.TopSurface,p.Transparency,p.Reflectance)
  142. if #storage < maximumstorage and p.Shape == "Block" then --recycle them
  143. p.Anchored = false
  144. p.FormFactor = "Custom"
  145. p.Size = stored_partsize
  146. p.Position = storage_position
  147. table.insert(storage,1,p)
  148. else --storage is full
  149. p:Destroy()
  150. end
  151. -- m.Text = m.Text-1
  152. end
  153. if p:IsDescendantOf(fragmentable) and p:GetMass()<53000 and p.Transparency<0.05 and p.Name~='Base' and tostring(p.Material)=='Enum.Material.Wood' and p:IsDescendantOf(ch)==false then
  154. fragmentate(p.CFrame,p.Size,p.BrickColor,position,radius,p.BackSurface,p.BottomSurface,p.FrontSurface,p.LeftSurface,p.RightSurface,p.TopSurface,p.Transparency,p.Reflectance)
  155. if #storage < maximumstorage and p.Shape == "Block" then --recycle them
  156. p.Anchored = true
  157. p.Material='Wood'
  158. p.FormFactor = "Custom"
  159. p.Size = stored_partsize
  160. p.Position = storage_position
  161. table.insert(storage,1,p)
  162. else --storage is full
  163. p:Destroy()
  164. end
  165. -- m.Text = m.Text-1
  166. end
  167. end
  168. list = {}
  169. -- print(tick()-t)
  170. end
  171.  
  172. --[[
  173. spawn(function()
  174. while wait() do --oh noes,a loop! So inefficient!
  175. if #storage < fillup then
  176. for i = 1, parts_created_per_frame do --creates parts to fill up the storage
  177. local p = Instance.new("Part",fragmentable)
  178. p.Anchored = false
  179. p.FormFactor = "Custom"
  180. p.Size = stored_partsize
  181. p.Position = storage_position
  182. table.insert(storage,1,p)
  183. end
  184. end
  185. end
  186. end)
  187. ]]
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211. --local blankn=22416261
  212.  
  213. --172121567
  214.  
  215. crosshairs={
  216. {38140824};
  217. {38140833};
  218. {38140839};
  219. {38140843};
  220. {38140852};
  221. {38140910};
  222. {38140915};
  223. {38140923};
  224. {38140928};
  225. {38140931};
  226. {38208259};
  227. {38208275};
  228. {38208284};
  229. {38208303};
  230. {38208310};
  231. {38208325};
  232. {38208330};
  233. {38208352};
  234. {38208359};
  235. {38208377}
  236. }
  237.  
  238. bulletholes={
  239. 172274695;
  240. 172274721
  241. }
  242.  
  243. for _,v in pairs(crosshairs) do
  244. game:service'ContentProvider':Preload('rbxassetid://' .. tostring(v[1]-1))
  245. end
  246.  
  247. currentIco=2
  248. switchIco=function(num)
  249. if num<20 then
  250. else
  251. num=20
  252. end
  253. mouse.Icon='rbxassetid://' .. tostring(crosshairs[num][1]-1)
  254. currentIco=num
  255. end
  256.  
  257. switchIco(currentIco)
  258.  
  259. heldDown=false
  260.  
  261. spreadint=1
  262. --[[Settings]]--
  263. recoil=false -- Set to true for added realism
  264. magCapacity=20 -- How much a magazine can hold at once
  265. magAmmo=20 -- How much ammo is in the mag
  266. crosshairSpread=5
  267. spread=1
  268. pAmmunition=true -- more damage if true
  269.  
  270.  
  271. jamRate=500 -- How often the gun jams(the more the less) (no less than 1)
  272.  
  273. primaryColor='Really black'
  274. secondaryColor='Really black'
  275.  
  276. slideReflectance=0.01
  277. slideMaterial='Plastic'
  278.  
  279. --[[Attachments]]--
  280.  
  281. silencer=true
  282. highCapMag=false -- High capacity magazine
  283. laser=true
  284. automatic=false
  285. grip=true
  286. local top = Instance.new("Shirt")
  287. top.ShirtTemplate = "rbxassetid://76408711"
  288. top.Parent = Character
  289. top.Name = "Cloth"
  290. local bottom = Instance.new("Pants")
  291. bottom.PantsTemplate = "rbxassetid://76408697"
  292. bottom.Parent = Character
  293. bottom.Name = "Cloth"
  294.  
  295. Base = New("Part",Head,"Base",{BrickColor = BrickColor.new("Institutional white"),Material = Enum.Material.SmoothPlastic,Transparency = 1,Transparency = 1,Size = Vector3.new(2, 1, 1),CFrame = CFrame.new(4.56395578, 30.9732971, 96.5572357, -1, 0, -3.7252903e-09, 0, 1, 0, -3.7252903e-09, 0, -1.00000012),CanCollide = false,BottomSurface = Enum.SurfaceType.Smooth,TopSurface = Enum.SurfaceType.Smooth,Color = Color3.new(0,0,0),})
  296. Mesh = New("SpecialMesh",Base,"Mesh",{Scale = Vector3.new(1,1,1),})
  297. Hood = New("Part",Head,"Hood",{Size = Vector3.new(2.04900002, 2.18899989, 1.97500002),CFrame = CFrame.new(4.59299994, 31.1469994, 96.4520035, -0.99907124, -0.00109502568, 0.043075189, -0.00244226633, 0.999509037, -0.0312363114, -0.0430198386, -0.0313125029, -0.998583436),BottomSurface = Enum.SurfaceType.Smooth,TopSurface = Enum.SurfaceType.Smooth,})
  298. Mesh = New("SpecialMesh",Hood,"Mesh",{MeshId = "rbxassetid://13640868",TextureId = "rbxassetid://13640869",MeshType = Enum.MeshType.FileMesh,})
  299. mot = New("Motor",Hood,"mot",{Part0 = Hood,Part1 = Base,C0 = CFrame.new(0, 0, 0, -0.99907124, -0.00244226633, -0.0430198386, -0.00109502568, 0.999509037, -0.0313125029, 0.043075189, -0.0312363114, -0.998583436),C1 = CFrame.new(-0.0290441513, 0.17370224, 0.105232239, -1, 0, 0, 0, 1, 0, 0, 0, -1),})
  300.  
  301.  
  302.  
  303. getSound=function(id)
  304. game:service'ContentProvider':Preload('rbxassetid'..tostring(id))
  305. local s=int("Sound",ch.Head)
  306. s.SoundId='rbxassetid://' .. tostring(id)
  307. s.Volume=1
  308. return s
  309. end
  310.  
  311. local fireSound=getSound(151997297--[[10209842]])
  312. fireSound.Pitch=1.3
  313. --1.8
  314.  
  315. local releaseSound=getSound(10209813)
  316. releaseSound.Pitch=4
  317.  
  318. local reloadSound=getSound(10209636)
  319. reloadSound.Pitch=3
  320.  
  321. local magazinelockSound=getSound(152206337)
  322. magazinelockSound.Pitch=1.4
  323.  
  324. local slideBackSound=getSound(152206263)
  325. slideBackSound.Pitch=2.5
  326.  
  327. local slideForwardSound=getSound(152206302)
  328. slideForwardSound.Pitch=2.5
  329.  
  330. local emptySound=getSound(2697295)
  331. emptySound.Pitch=5
  332.  
  333. local glassBreakSound=getSound(144884907)
  334.  
  335. local woodImpact=getSound(142082171)
  336.  
  337. local fleshImpact=getSound(144884872)
  338. fleshImpact.Pitch=1.7
  339.  
  340. if ch:findFirstChild("Tec-99") then
  341. ch['Tec-99']:Destroy()
  342. end
  343.  
  344. local tube=int("Model",ch)
  345. tube.Name='Tec-99'
  346. local hopper=Instance.new('HopperBin',plr.Backpack)
  347. hopper.Name=tube.Name
  348. Weld = function(p0,p1,x,y,z,rx,ry,rz,par)--recommend to use this with my weld. use this function only with arm lockers.
  349. p0.Position = p1.Position
  350. local w = Instance.new('Motor',par or p0)
  351. w.Part0 = p1
  352. w.Part1 = p0
  353. w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0)
  354. w.MaxVelocity = .1
  355. return w
  356. end
  357. function clerp(c1,c2,sp)
  358. local R1,R2,R3 = c1:toEulerAnglesXYZ()
  359. local R21,R22,R23 = c2:toEulerAnglesXYZ()
  360. return CFrame.new(
  361. c1.X + (c2.X-c1.X)*sp,
  362. c1.Y + (c2.Y-c1.Y)*sp,
  363. c1.Z + (c2.Z-c1.Z)*sp)*CFrame.Angles(
  364. R1 + (R21-R1)*sp,
  365. R2 + (R22-R2)*sp,
  366. R3 + (R23-R3)*sp
  367. )
  368. end
  369.  
  370. tweenTable={}
  371. Tween = function(Weld, Stop, Step,a)
  372. ypcall(function()
  373. local func = function()
  374. local Start = Weld.C1
  375. local X1, Y1, Z1 = Start:toEulerAnglesXYZ()
  376. local Stop = Stop
  377. local X2, Y2, Z2 = Stop:toEulerAnglesXYZ()
  378. if not Step then Step=0.1 end
  379. table.insert(tweenTable,{th=0,Weld=Weld,Step=Step,Start=Start,X1=X1,Y1=Y1,Z1=Z1,Stop=Stop,X2=X2,Y2=Y2,Z2=Z2})
  380. end
  381. if a then coroutine.wrap(func)() else func() end
  382. end)
  383. end
  384. weld=function(p0,p1,c0)
  385. local w=Instance.new("Weld",p0)
  386. w.Part0=p0
  387. w.Part1=p1
  388. w.C0=c0
  389. return w
  390. end
  391. cp=function(parent,color,size,anchored,cancollide)
  392. local newp=Instance.new("Part",parent)
  393. newp.TopSurface='SmoothNoOutlines'
  394. newp.BottomSurface='SmoothNoOutlines'
  395. newp.FrontSurface='SmoothNoOutlines'
  396. newp.BackSurface='SmoothNoOutlines'
  397. newp.RightSurface='SmoothNoOutlines'
  398. newp.LeftSurface='SmoothNoOutlines'
  399. newp.FormFactor="Custom"
  400. newp.BrickColor=bc(color)
  401. newp.Size=size
  402. newp.Anchored=anchored
  403. newp.CanCollide=cancollide
  404. newp:BreakJoints()
  405. return newp
  406. end
  407.  
  408. initializeJoints=function()
  409. rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker'
  410. rabr.Position = torso.Position
  411. rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw'
  412. w = Instance.new("Weld",tube)
  413. w.Part0,w.Part1 = ch['Right Arm'],rabr
  414. w.C1 = CFrame.new(0,-.5,0)
  415. labr = cp(tube,'White',Vector3.new(1,1,1),false,false) labr.Transparency = 1 labr.Name='Locker'
  416. labr.Position = torso.Position
  417. lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = tube lw.Name = 'lw'
  418. ww = Instance.new("Weld",tube)
  419. ww.Part0,ww.Part1 = ch['Left Arm'],labr
  420. ww.C1 = CFrame.new(0,-.5,0)
  421. end
  422.  
  423. initializeJoints()
  424.  
  425. --[[ leg locks
  426. rabl = cp(tube,'White',Vector3.new(1,1,1),false,false) rabl.Transparency = 1 rabl.Name='Locker'
  427. rabl.Position = torso.Position
  428. rwl = Weld(rabl,torso,0.5,-1.5,0,0,0,0) rwl.Parent = tube rwl.Name = 'rwl'
  429. wl = Instance.new("Weld",tube)
  430. wl.Part0,wl.Part1 = ch['Right Leg'],rabl
  431. wl.C1 = CFrame.new(0,-.5,0)
  432. labl = cp(tube,'White',Vector3.new(1,1,1),false,false) labl.Transparency = 1 labl.Name='Locker'
  433. labl.Position = torso.Position
  434. lwl = Weld(labl,torso,-0.5,-1.5,0,0,0,0) lwl.Parent = tube lwl.Name = 'lwl'
  435. wwl = Instance.new("Weld",tube)
  436. wwl.Part0,wwl.Part1 = ch['Left Leg'],labl
  437. wwl.C1 = CFrame.new(0,-.5,0)
  438. ]]
  439. --weld(ch['HumanoidRootPart'],torso,cfn())
  440.  
  441.  
  442. local counter=Instance.new('ScreenGui',plr.PlayerGui)
  443. local frame=Instance.new('Frame',counter)
  444. frame.Size=UDim2.new(0.25,0,0.3,0)
  445.  
  446. frame.Position=UDim2.new(0.1,0,0.4,0)
  447. frame.BackgroundTransparency=1
  448.  
  449. local ammocounter=Instance.new('TextLabel',frame)
  450. ammocounter.Size=UDim2.new(1,0,0.3,0)
  451. ammocounter.Position=UDim2.new(0,0,0.2,0)
  452. ammocounter.BackgroundTransparency=1
  453. ammocounter.TextColor3=BrickColor.new('White').Color
  454. ammocounter.Font='SourceSansBold'
  455. ammocounter.FontSize='Size18'
  456. ammocounter.Text=''
  457. ammocounter.TextXAlignment='Left'
  458.  
  459.  
  460. local bg = Instance.new("BodyGyro",rootpart)
  461. bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  462. bg.P = 10000
  463. bg.D = 100
  464.  
  465.  
  466. cyl=function(prt)
  467. local c=int("CylinderMesh",prt)
  468. return c
  469. end
  470. blo=function(prt)
  471. local c=int("BlockMesh",prt)
  472. return c
  473. end
  474.  
  475. if laser then
  476. aLaser=cp(tube,'Really red',Vector3.new(0.2,0.2,0.2))
  477. aLaser.Transparency=1
  478. cyl(aLaser).Scale=Vector3.new(0.25,1,0.25)
  479. aLaser.Anchored=true
  480. end
  481.  
  482. local handle=cp(tube,primaryColor,Vector3.new(0.2,0.6,0.3))
  483. blo(handle).Scale=Vector3.new(1.15,0.9,1)
  484. local mw=weld(ch['Right Arm'],handle,cfn(-0.4,-1,-0.19)*ang(mr(-101.5),0,0)*cfn()*ang(0,mr(-30),mr(-5)))
  485.  
  486. local framepiece1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.9))
  487. blo(framepiece1).Scale=Vector3.new(1.15,0.5,1)
  488. weld(handle,framepiece1,cfn(0,0.354,-0.3)*ang(mr(11.5),0,0))
  489.  
  490. local barrel=cp(tube,'Medium stone grey',Vector3.new(0.2,0.2,0.2))
  491. cyl(barrel).Scale=Vector3.new(0.7,1.2,0.7)
  492. weld(framepiece1,barrel,cfn(0,0.15,-0.1)*ang(mr(-90),0,0))
  493.  
  494. local sbarrel=cp(tube,'Really black',Vector3.new(0.2,0.3,0.2))
  495. cyl(sbarrel).Scale=Vector3.new(0.7,1.5,0.7)
  496. weld(barrel,sbarrel,cfn(0,0.35,0))
  497. local hole=cp(tube,'White',Vector3.new(0.2,0.2,0.2))
  498. hole.Transparency=1
  499. weld(sbarrel,hole,cfn(0,0.2,0))
  500. local flash=int('PointLight',hole)
  501. flash.Enabled=false
  502. flash.Range=10
  503. flash.Color=BrickColor.new('Neon orange').Color
  504.  
  505.  
  506. local slide1=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.4))
  507. slide1.CanCollide=false
  508. blo(slide1).Scale=Vector3.new(0.7,1,1.1)
  509. slideweld1=weld(framepiece1,slide1,cfn(0,0.15,0.23))
  510. slide1.Reflectance=slideReflectance
  511. slide1.Material=slideMaterial
  512.  
  513. local slide2=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.4))
  514. slide2.CanCollide=false
  515. blo(slide2).Scale=Vector3.new(0.7,1,1.1)
  516. slideweld2=weld(slide1,slide2,cfn(0,0,-0.666))
  517. slide2.Reflectance=slideReflectance
  518. slide2.Material=slideMaterial
  519.  
  520. local slideside1=cp(tube,secondaryColor,Vector3.new(0.2,0.2,1.1))
  521. slideside1.CanCollide=true
  522. blo(slideside1).Scale=Vector3.new(0.25,1,1)
  523. weld(slide1,slideside1,cfn(-0.09,0,-0.335))
  524. slideside1.Reflectance=slideReflectance
  525. slideside1.Material=slideMaterial
  526.  
  527. local slideside2=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.4))
  528. slideside2.CanCollide=true
  529. blo(slideside2).Scale=Vector3.new(0.25,1,1.1)
  530. weld(slide1,slideside2,cfn(0.09,0,0))
  531. slideside2.Reflectance=slideReflectance
  532. slideside2.Material=slideMaterial
  533.  
  534. local slideside3=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.3))
  535. slideside3.CanCollide=true
  536. blo(slideside3).Scale=Vector3.new(0.25,0.6,0.78)
  537. weld(slideside2,slideside3,cfn(0,-0.04,-0.335))
  538. slideside3.Reflectance=slideReflectance
  539. slideside3.Material=slideMaterial
  540.  
  541. local slideside4=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.4))
  542. blo(slideside4).Scale=Vector3.new(0.25,1,1.1)
  543. weld(slide2,slideside4,cfn(0.09,0,0))
  544. slideside4.Reflectance=slideReflectance
  545. slideside4.Material=slideMaterial
  546.  
  547. local mgs=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  548. blo(mgs).Scale=Vector3.new(1.15,0.425,0.245)
  549. weld(handle,mgs,cfn(0,-0.3,0.125))
  550.  
  551. --[[Trigger]]--
  552. local tp1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  553. blo(tp1).Scale=Vector3.new(0.6,0.1,0.8)
  554. weld(framepiece1,tp1,cfn(0,-0.22,0.13))
  555.  
  556. local tp2=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  557. blo(tp2).Scale=Vector3.new(0.6,0.1,1.19)
  558. weld(framepiece1,tp2,cfn(0,-0.14,-0.0265)*ang(mr(45),0,0))
  559.  
  560. local trigger1=cp(tube,'Really black',Vector3.new(0.2,0.2,0.2))
  561. blo(trigger1).Scale=Vector3.new(0.3,0.4,0.16)
  562. weld(framepiece1,trigger1,cfn(0,-0.07,0.09))
  563.  
  564. local trigger2=cp(tube,'Really black',Vector3.new(0.2,0.2,0.2))
  565. blo(trigger2).Scale=Vector3.new(0.3,0.3,0.16)
  566. weld(trigger1,trigger2,cfn(0,-0.06,-0.015)*ang(mr(30),0,0))
  567.  
  568.  
  569. --[[Magazine]]--
  570.  
  571. local magh=cp(tube,'Really black',Vector3.new(0.2,0.5,0.2))
  572. blo(magh).Scale=Vector3.new(0.6,1,1)
  573. local magweld=weld(handle,magh,cfn(0,-0.025,0))
  574.  
  575. local bottom=cp(tube,'Really black',Vector3.new(0.2,0.2,0.3))
  576. blo(bottom).Scale=Vector3.new(1.15,0.385,0.8)
  577. bottomweld=weld(magh,bottom,cfn(0,-0.28,-0.015))
  578.  
  579. if highCapMag then
  580. magweld:Destroy()
  581. magh.Size=Vector3.new(0.2,0.7,0.2)
  582. magweld=weld(handle,magh,cfn(0,-0.125,0))
  583. bottomweld:Destroy()
  584. bottomweld=weld(magh,bottom,cfn(0,-0.38,-0.015))
  585. magCapacity=magCapacity+23
  586. magAmmo=magAmmo+23
  587. end
  588.  
  589. --[[Sights]]--
  590. local backsight1=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
  591. blo(backsight1).Scale=Vector3.new(0.3,0.3,0.3)
  592. weld(slide1,backsight1,cfn(0.06,0.1,0.13))
  593. local backsight2=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
  594. blo(backsight2).Scale=Vector3.new(0.3,0.3,0.3)
  595. weld(slide1,backsight2,cfn(-0.06,0.1,0.13))
  596.  
  597. local frontsight=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
  598. blo(frontsight).Scale=Vector3.new(0.3,0.3,0.3)
  599. weld(slide1,frontsight,cfn(0,0.1,-0.85))
  600.  
  601. local dot1=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
  602. cyl(dot1).Scale=Vector3.new(0.1,0.31,0.1)
  603. weld(backsight1,dot1,cfn(0,0.014,0)*ang(mr(-90),0,0))
  604.  
  605. local dot2=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
  606. cyl(dot2).Scale=Vector3.new(0.1,0.31,0.1)
  607. weld(backsight2,dot2,cfn(0,0.014,0)*ang(mr(-90),0,0))
  608.  
  609. local dot3=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
  610. cyl(dot3).Scale=Vector3.new(0.1,0.31,0.1)
  611. weld(frontsight,dot3,cfn(0,0.014,0)*ang(mr(-90),0,0))
  612.  
  613. local ba=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.2))
  614. blo(ba).Scale=Vector3.new(1.15,0.5,1)
  615. weld(framepiece1,ba,cfn(0,0,-0.55))
  616. ba.Reflectance=slideReflectance
  617. ba.Material=slideMaterial
  618.  
  619. local weirdholethatpistolshave=cp(tube,'Really black', Vector3.new(0.2,0.2,0.2))
  620. cyl(weirdholethatpistolshave).Scale=Vector3.new(0.4,1.01,0.4)
  621. weld(ba,weirdholethatpistolshave,cfn(0,0,0)*ang(mr(-90),0,0))
  622.  
  623. --[[Tactical Rails]]--
  624.  
  625. local r1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  626. blo(r1).Scale=Vector3.new(1.15,0.2,0.25)
  627. weld(framepiece1,r1,cfn(0,-0.05,-0.17))
  628.  
  629. local r2=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  630. blo(r2).Scale=Vector3.new(1.15,0.2,0.25)
  631. weld(framepiece1,r2,cfn(0,-0.05,-0.27))
  632.  
  633. local r3=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  634. blo(r3).Scale=Vector3.new(1.15,0.2,0.25)
  635. weld(framepiece1,r3,cfn(0,-0.05,-0.37))
  636.  
  637. if laser then
  638. local base=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.3))
  639. blo(base).Scale=Vector3.new(1.15,1,1)
  640. weld(r2,base,cfn(0,-0.05,0))
  641. basehole=cp(tube,'White',Vector3.new(0.2,0.2,0.2))
  642. cyl(basehole).Scale=Vector3.new(0.4,0.4,0.4)
  643. weld(base,basehole,cfn(0,0,-0.13)*ang(mr(-90),0,0))
  644. end
  645.  
  646. if silencer then
  647. local sil=cp(tube,'Really black',Vector3.new(0.2,0.3,0.2))
  648. fireSound.SoundId='rbxassetid://153230595'
  649. fireSound.Pitch=1
  650. cyl(sil).Scale=Vector3.new(0.94,1.8,0.94)
  651. weld(hole,sil,cfn(0,0.29,0))
  652. end
  653.  
  654. if grip then
  655. local base=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.3))
  656. blo(base).Scale=Vector3.new(1.15,1,1)
  657. weld(r2,base,cfn(0,-0.05,0))
  658. local hd=cp(tube,primaryColor,Vector3.new(0.2,0.6,0.2))
  659. cyl(hd)
  660. weld(base,hd,cfn(0,-0.3,0))
  661. crosshairSpread=3
  662. spreadint=spreadint-0.3
  663. end
  664.  
  665. --[[Test Functions]]--
  666.  
  667. local debounce=false
  668. local out=false
  669. local bs=false
  670. cockSlide=function() -- hahaha yes i know
  671. slideBackSound:Play()
  672. if magAmmo<1 and out==true and bs==false then
  673. wait()
  674. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  675. else
  676. for i=1,2 do
  677. wait()
  678. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  679. end
  680. end
  681. local ajar=false
  682. if magAmmo==1 then
  683. ajar=true
  684. end
  685. if magAmmo>0 then
  686. createShell()
  687. --magAmmo=magAmmo-1
  688. ammocounter.Text=''
  689. for i=1,magAmmo do
  690. ammocounter.Text=ammocounter.Text .. 'I'
  691. end
  692. end
  693. wait(0.15)
  694. slideForwardSound:Play()
  695. for i=1,2 do
  696. wait()
  697. slideweld1.C0=slideweld1.C0*cfn(0,0,-0.22)
  698. end
  699. if ajar==true then
  700. out=true
  701. slideweld1.C0=cfn(0,0.15,0.23)
  702. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  703. end
  704. end
  705.  
  706. --fx
  707. local firefx=cp(tube,'Neon orange',Vector3.new(0.7,1.1,0.7))
  708. firefx.Transparency=1
  709. local mesh=Instance.new('SpecialMesh',firefx)
  710. mesh.MeshType='Sphere'
  711. firefx.Material='Neon'
  712. weld(hole,firefx,cfn(0,1,0))
  713.  
  714. local smokefx=Instance.new('Smoke',hole)
  715. smokefx.Enabled=false
  716. barrel.CanCollide=true
  717.  
  718.  
  719.  
  720.  
  721. local oc = oc or function(...) return ... end
  722.  
  723. function ragJoint(hit,r,d)
  724. Spawn(oc(function()
  725. d = d or 0
  726. local rpar,r0,r1 = r.Parent,r.Part0,r.Part1
  727. if d > 0 then wait(d) end
  728. local p = hit:Clone()
  729. p:BreakJoints()
  730. p:ClearAllChildren()
  731. p.FormFactor = "Custom"
  732. p.Size = p.Size/2
  733. p.Transparency = 1
  734. p.CanCollide = true
  735. p.Name = "Colliduh"
  736. p.Parent = hit
  737. local w = Instance.new("Weld",p)
  738. w.Part0 = hit
  739. w.Part1 = p
  740. w.C0 = CFrame.new(0,-p.Size.Y/2,0)
  741. local rot = Instance.new("Rotate",rpar)
  742. rot.Name = r.Name
  743. rot.Part0 = r0
  744. rot.Part1 = r1
  745. rot.C0 = r.C0
  746. rot.C1 = r.C1
  747. r0.Velocity = Vector3.new()
  748. r1.Velocity = Vector3.new()
  749. r:Destroy()
  750. end))
  751. end
  752.  
  753.  
  754. createShell=function()
  755. local shell=cp(tube,'Deep orange',Vector3.new(0.2,0.3,0.2))
  756. shell.CanCollide=true
  757. shell.Reflectance=0.3
  758. cyl(shell)
  759. shell.CFrame=barrel.CFrame*ang(mr(-90),0,0)
  760. magAmmo=magAmmo-1
  761. ammocounter.Text=''
  762. for i=1,magAmmo do
  763. ammocounter.Text=ammocounter.Text .. 'I'
  764. end
  765. game.Debris:AddItem(shell,3)
  766. end
  767.  
  768. reloadPistol=function()
  769. local current=magAmmo
  770. Tween(lw,cfn())
  771. Tween(rw,cfn()*ang(mr(-102),0,0))
  772. wait(0.4)
  773. releaseSound:Play()
  774. bottom.Transparency=1
  775. magh.Transparency=1
  776. local mag1=magh:clone()
  777. mag1.Transparency=0
  778. mag1.Weld:Destroy''
  779. local mag2=bottom:clone()
  780. mag2.Transparency=0
  781. mag1:BreakJoints''
  782. mag2:BreakJoints''
  783. local bm1=mag1:clone()
  784. local bm2=mag2:clone()
  785. mag1.Parent=tube
  786. mag2.Parent=tube
  787. mag1.CFrame=magh.CFrame
  788. weld(mag1,mag2,cfn(0,-0.28,-0.015))
  789. magAmmo=0
  790. ammocounter.Text=''
  791. for i=1,magAmmo do
  792. ammocounter.Text=ammocounter.Text .. 'I'
  793. end
  794. wait()
  795. mag1.CanCollide=true
  796. mag2.CanCollide=true
  797. game.Debris:AddItem(mag1,2)
  798. game.Debris:AddItem(mag2,2)
  799. wait(0.1)
  800. Tween(lw,cfn()*ang(mr(25),0,0))
  801. bm1.Parent=tube
  802. bm2.Parent=tube
  803. weld(bm1,bm2,cfn(0,-0.28,-0.015))
  804. local fa=weld(ch['Left Arm'],bm1,cfn(0,-1.1,0)*ang(mr(-90),0,0))
  805. wait(0.1)
  806. Tween(lw,cfn(0,1.4,0)*ang(mr(-109),mr(60),mr(10)),0.07)
  807. wait(0.25)
  808. magazinelockSound:Play()
  809. wait()
  810. -- reloadSound:Play()
  811. fa:Destroy''
  812. bm1:Destroy''
  813. bm2:Destroy''
  814. bottom.Transparency=0
  815. magh.Transparency=0
  816. local totalcap=0
  817. if current<1 then --none in chamber reload
  818. --slideweld1.C0=cfn(0,0,0.45)
  819. Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0))
  820. Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(35),0))
  821. wait(0.1)
  822. spawn(function()
  823. cockSlide()
  824. end)
  825. Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(55),0))
  826. wait(0.3)
  827. totalcap=magCapacity
  828. else
  829. totalcap=magCapacity+1
  830. end
  831. magAmmo=totalcap
  832. out=false
  833. ammocounter.Text=''
  834. for i=1,magAmmo do
  835. ammocounter.Text=ammocounter.Text .. 'I'
  836. end
  837. restorePosition()
  838. end
  839.  
  840. firePistol=function()
  841. switchIco(currentIco+crosshairSpread)
  842. if not jammed and not out then
  843. spread=spread+spreadint
  844. end
  845. print(spread)
  846. fireSound.Pitch=math.random(math.random(fireSound.Pitch-0.2,fireSound.Pitch-0.1),math.random(fireSound.Pitch,fireSound.Pitch+0.1))
  847. if magAmmo>0 and jammed==false then
  848. local ajar=false
  849. if magAmmo==1 then
  850. ajar=true
  851. end
  852. user=ch
  853. local ray = Ray.new(hole.CFrame.p, ((m.Hit.p+Vector3.new(math.random(-spread,spread)/6.35,math.random(-spread,spread)/6.35,math.random(-spread,spread)/6.35) )- hole.CFrame.p).unit*300)
  854. local hit, position = game.Workspace:FindPartOnRay(ray, user)
  855. if hit then
  856. if hit.Transparency>0.285 and hit:GetMass()<3000 and hit.Parent.className~='Hat' then
  857. local temps=glassBreakSound:clone()
  858. temps.Parent=hit
  859. temps.Pitch=math.random(math.random(temps.Pitch-0.2,temps.Pitch-0.1),math.random(temps.Pitch,temps.Pitch+0.1))
  860. temps:Play''
  861. start_fragmentation(position,.25)
  862. end
  863. if tostring(hit.Material)=='Enum.Material.Wood' and hit.Transparency<0.05 then
  864. local temps=woodImpact:clone()
  865. temps.Volume=1
  866. temps.Pitch=math.random(math.random(temps.Pitch-0.2,temps.Pitch-0.1),math.random(temps.Pitch,temps.Pitch+0.1))
  867. temps.Parent=hit
  868. temps:Play''
  869. start_fragmentation(position,.15)
  870. end
  871. ypcall(function()
  872. if hit and hit.Parent and hit.Parent:findFirstChild'Humanoid' then
  873. local temps=fleshImpact:clone()
  874. temps.Parent=hit
  875. temps:Play()
  876. if hit.Name~='Head' then
  877. if pAmmunition==true then
  878. hit.Parent.Humanoid:TakeDamage(math.random(30,65))
  879. else
  880. hit.Parent.Humanoid:TakeDamage(math.random(10,24))
  881. end
  882. local guy=hit.Parent
  883. if guy.Name~='TheDarkRevenant' then
  884. for i,v in pairs(guy:GetChildren()) do
  885. if v.className=='Hat' then
  886. v.Handle:BreakJoints()
  887. end
  888. local r = guy.Torso:FindFirstChild(v.Name:gsub("Arm","Shoulder"):gsub("Leg","Hip"))
  889. if v:IsA("BasePart") and r then
  890. ragJoint(v,r,.1)
  891. elseif v:IsA("Humanoid") then
  892. spawn(function()
  893. wait(0.5)
  894. v.PlatformStand = true
  895. v.Changed:connect(function()
  896. v.PlatformStand = true
  897. end)
  898. end)
  899. end
  900. end
  901. end
  902.  
  903. else
  904. if hit.Parent.Name~='TheDarkRevenant' then
  905. hit.Parent:BreakJoints()
  906. end
  907. end
  908. end
  909.  
  910. if hit.Parent.className=='Hat' then
  911. hit.CanCollide=true
  912. hit:BreakJoints()
  913. hit.Velocity=m.Hit.p*5
  914. end
  915. end)
  916. end
  917. if m.Target then
  918. local p = Instance.new("Part")
  919. p.formFactor = "Custom"
  920. p.Size = Vector3.new(0.5,0.5,0.5)
  921. p.Transparency = 1
  922. p.CanCollide = false
  923. p.Locked = true
  924. p.CFrame = CFrame.new(position.x,position.y,position.z)--mouse.Target.CFrame+(mouse.Hit.p-mouse.Target.Position)
  925. local w = Instance.new("Weld")
  926. w.Part0 = mouse.Target
  927. w.Part1 = p
  928. w.C0 = mouse.Target.CFrame:inverse()
  929. w.C1 = p.CFrame:inverse()
  930. w.Parent = p
  931. local d = Instance.new("Decal")
  932. d.Parent = p
  933. d.Face = mouse.TargetSurface
  934. d.Texture = 'rbxassetid://' .. tostring(bulletholes[math.random(#bulletholes)]-2)
  935. p.Parent = tube
  936. game.Debris:AddItem(p,6)
  937. end
  938. if recoil==true then
  939. cam:SetRoll(math.random(-2,2))
  940. cam:TiltUnits(0.501)
  941. end
  942. local th=cp(tube,"Really black",Vector3.new(1,1,1))
  943. th.CanCollide=false
  944. th.Anchored=true
  945. th.CFrame=CFrame.new(position.x,position.y,position.z)
  946. local spm=Instance.new('SpecialMesh',th)
  947. spm.MeshType='Sphere'
  948. spm.Scale=Vector3.new(0.05,0.05,0.05)
  949. spawn(function()
  950. for i=1,5 do
  951. wait()
  952. spm.Scale=spm.Scale+Vector3.new(0.16,0.16,0.16)
  953. th.Transparency=th.Transparency+0.2
  954. end
  955. th:Destroy()
  956. end)
  957. fireSound:Play()
  958. spawn(function()
  959. firefx.Transparency=0
  960. wait()
  961. firefx.Transparency=1
  962. end)
  963. spawn(function()
  964. flash.Enabled=true
  965. for i=1,2 do
  966. wait()
  967. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  968. end
  969. flash.Enabled=false
  970. createShell()
  971. for i=1,2 do
  972. wait()
  973. slideweld1.C0=slideweld1.C0*cfn(0,0,-0.22)
  974. end
  975. slideweld1.C0=cfn(0,0.15,0.23)
  976. if ajar==true then
  977. out=true
  978. slideweld1.C0=cfn(0,0.15,0.23)
  979. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  980. end
  981. end)
  982. ammocounter.Text=''
  983. for i=1,magAmmo do
  984. ammocounter.Text=ammocounter.Text .. 'I'
  985. end
  986. wait()
  987. Tween(rw,cfn(0,0.7,0)*ang(mr(-100),mr(-30),0),0.62)
  988. if not grip then
  989. Tween(lw,cfn(0,0.7,0)*ang(mr(-100),mr(30),0),0.62)
  990. else
  991. Tween(lw,cfn(0,1.3,0)*ang(mr(-100),mr(30),0),0.62)
  992. end
  993. wait(0.065)
  994. restorePosition(0.3)
  995. else
  996. if magAmmo<1 then
  997. slideweld1.C0=cfn(0,0.15,0.23)
  998. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  999. end
  1000. emptySound:Play()
  1001. end
  1002. if math.random(jamRate)==jamRate and magAmmo>0 then
  1003. jammed=true
  1004. end
  1005. end
  1006.  
  1007. debounced=function()
  1008. if sheathed==false and debounce==false then
  1009. return true
  1010. end
  1011. end
  1012.  
  1013. mouse.Button1Down:connect(function()
  1014. if debounced() then
  1015. if automatic==false then
  1016. debounce=true
  1017. firePistol()
  1018. debounce=false
  1019. else
  1020. heldDown=true
  1021. firePistol()
  1022. end
  1023. end
  1024. end)
  1025.  
  1026. mouse.Button1Up:connect(function()
  1027. heldDown=false
  1028. end)
  1029.  
  1030. sheathGun=function()
  1031. ammocounter.Visible=false
  1032. if laser then
  1033. laserEnabled=false
  1034. aLaser.Transparency=1
  1035. end
  1036. Tween(rw,cfn())
  1037. Tween(lw,cfn())
  1038. wait(0.1)
  1039. mw:Destroy''
  1040. mw=nil
  1041. mw=weld(tor,handle,cfn(1.11,-1.09,0)*ang(mr(-111.5),0,0))
  1042. labr:Destroy()
  1043. rabr:Destroy()
  1044. bg.maxTorque=Vector3.new()
  1045. sheathed=true
  1046. end
  1047.  
  1048. unsheathGun=function()
  1049. ammocounter.Visible=true
  1050. mw:Destroy''
  1051. mw=nil
  1052. initializeJoints()
  1053. mw=weld(ch['Right Arm'],handle,cfn(-0.4,-1,-0.19)*ang(mr(-101.5),0,0)*cfn()*ang(0,mr(-30),mr(-5)))
  1054. restorePosition()
  1055. bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  1056. sheathed=false
  1057. end
  1058.  
  1059. laserEnabled=false
  1060.  
  1061. mouse.KeyDown:connect(function(key)
  1062. if key=='r' and debounced() then
  1063. debounce=true
  1064. reloadPistol()
  1065. debounce=false
  1066. elseif key=='f' and debounced() then
  1067. debounce=true
  1068. bs=true
  1069. Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0))
  1070. Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(35),0))
  1071. wait(0.1)
  1072. spawn(function()
  1073. cockSlide()
  1074. end)
  1075. Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(55),0))
  1076. wait(0.3)
  1077. jammed=false
  1078. restorePosition()
  1079. bs=false
  1080. debounce=false
  1081. elseif key=='l' and debounced() then
  1082. if not laserEnabled then
  1083. laserEnabled=true
  1084. aLaser.Transparency=0.35
  1085. else
  1086. laserEnabled=false
  1087. aLaser.Transparency=1
  1088. end
  1089. end
  1090. end)
  1091.  
  1092. restorePosition=function(speed)
  1093. if not grip then
  1094. Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0),speed)
  1095. Tween(lw,cfn(0,0.7,0)*ang(mr(-90),mr(30),0),speed)
  1096. else
  1097. Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0),speed)
  1098. Tween(lw,cfn(0,1.3,0)*ang(mr(-90),mr(30),0),speed)
  1099. end
  1100. end
  1101.  
  1102. hopper.Selected:connect(function()
  1103. unsheathGun()
  1104. end)
  1105.  
  1106. hopper.Deselected:connect(function()
  1107. sheathGun()
  1108. end)
  1109.  
  1110. game:service'RunService'.RenderStepped:connect(function()
  1111. bg.cframe = CFrame.new(rootpart.Position,mouse.Hit.p*Vector3.new(1,0,1)+rootpart.Position*Vector3.new(0,1,0))
  1112. if laserEnabled==true then
  1113. local user=ch
  1114. local ray = Ray.new(hole.CFrame.p, (m.Hit.p - hole.CFrame.p).unit*300)
  1115. local hit, position = game.Workspace:FindPartOnRay(ray, user)
  1116. local distance = (position - basehole.CFrame.p).magnitude
  1117. aLaser.Size=Vector3.new(0.2,distance,0.2)
  1118. aLaser.CFrame=CFrame.new(position, basehole.CFrame.p) * CFrame.new(0, 0, -distance/2) * ang(mr(-90),0,0)
  1119. end
  1120. for _,v in pairs(tweenTable) do
  1121. if v.Weld.C1==v.Stop then
  1122. table.remove(tweenTable,_)
  1123. else
  1124. if v.th<0.9 then
  1125. v.th=v.th+v.Step
  1126. i=v.th
  1127. v.Weld.C1 = CFrame.new( (v.Start.p.X * (1 - i)) + (v.Stop.p.X * i),
  1128. (v.Start.p.Y * (1 - i)) + (v.Stop.p.Y * i),
  1129. (v.Start.p.Z * (1 - i)) + (v.Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ(
  1130. (v.X1 * (1 - i)) + (v.X2 * i), (v.Y1 * (1 - i)) + (v.Y2 * i),
  1131. (v.Z1 * (1 - i)) + (v.Z2 * i) )
  1132. else
  1133. v.Weld.C1 = v.Stop
  1134. end
  1135. end
  1136. end
  1137. end)
  1138. for i=1,magAmmo do
  1139. ammocounter.Text=ammocounter.Text .. 'I'
  1140. end
  1141.  
  1142. sheathGun()
  1143.  
  1144. spawn(function()
  1145. while wait(0.07) do
  1146. if heldDown==true then
  1147. spawn(function()
  1148. firePistol()
  1149. end)
  1150. end
  1151. end
  1152. end)
  1153. m.TargetFilter=tube
  1154.  
  1155. while wait(0.03) do
  1156. if spread>1 then
  1157. spread=spread-spreadint/4
  1158. end
  1159. if spread<1 then
  1160. spread=1
  1161. end
  1162. if currentIco>2 then
  1163. switchIco(currentIco-1)
  1164. end
  1165. end
  1166.  
  1167. --hl/https://httpget-inumeration.c9.io/mp45.lua
  1168. --local/game.Players.Conmiro:Destroy''
Advertisement
Add Comment
Please, Sign In to add comment