SomeRandomD00D

gnureu

Jul 4th, 2018
113
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. VT = Vector3.new
  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. local PRT = CreatePart(3, Character, "Fabric", 0, 0, "Really black", "Hood", VT(1,1,1),false)
  295. PRT.Color = C3(0,0,0)
  296. local HoodWeld = CreateWeldOrSnapOrMotor("Weld", Head, Head, PRT, CF(0,0.7,0), CF(0, 0, 0))
  297. CreateMesh("SpecialMesh", PRT, "FileMesh", "13640868", "13640869", VT(1,1,1)*1.05, VT(0,0,0))
  298.  
  299.  
  300.  
  301. getSound=function(id)
  302. game:service'ContentProvider':Preload('rbxassetid'..tostring(id))
  303. local s=int("Sound",ch.Head)
  304. s.SoundId='rbxassetid://' .. tostring(id)
  305. s.Volume=1
  306. return s
  307. end
  308.  
  309. local fireSound=getSound(151997297--[[10209842]])
  310. fireSound.Pitch=1.3
  311. --1.8
  312.  
  313. local releaseSound=getSound(10209813)
  314. releaseSound.Pitch=4
  315.  
  316. local reloadSound=getSound(10209636)
  317. reloadSound.Pitch=3
  318.  
  319. local magazinelockSound=getSound(152206337)
  320. magazinelockSound.Pitch=1.4
  321.  
  322. local slideBackSound=getSound(152206263)
  323. slideBackSound.Pitch=2.5
  324.  
  325. local slideForwardSound=getSound(152206302)
  326. slideForwardSound.Pitch=2.5
  327.  
  328. local emptySound=getSound(2697295)
  329. emptySound.Pitch=5
  330.  
  331. local glassBreakSound=getSound(144884907)
  332.  
  333. local woodImpact=getSound(142082171)
  334.  
  335. local fleshImpact=getSound(144884872)
  336. fleshImpact.Pitch=1.7
  337.  
  338. if ch:findFirstChild("Tec-99") then
  339. ch['Tec-99']:Destroy()
  340. end
  341.  
  342. local tube=int("Model",ch)
  343. tube.Name='Tec-99'
  344. local hopper=Instance.new('HopperBin',plr.Backpack)
  345. hopper.Name=tube.Name
  346. 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.
  347. p0.Position = p1.Position
  348. local w = Instance.new('Motor',par or p0)
  349. w.Part0 = p1
  350. w.Part1 = p0
  351. w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0)
  352. w.MaxVelocity = .1
  353. return w
  354. end
  355. function clerp(c1,c2,sp)
  356. local R1,R2,R3 = c1:toEulerAnglesXYZ()
  357. local R21,R22,R23 = c2:toEulerAnglesXYZ()
  358. return CFrame.new(
  359. c1.X + (c2.X-c1.X)*sp,
  360. c1.Y + (c2.Y-c1.Y)*sp,
  361. c1.Z + (c2.Z-c1.Z)*sp)*CFrame.Angles(
  362. R1 + (R21-R1)*sp,
  363. R2 + (R22-R2)*sp,
  364. R3 + (R23-R3)*sp
  365. )
  366. end
  367.  
  368. tweenTable={}
  369. Tween = function(Weld, Stop, Step,a)
  370. ypcall(function()
  371. local func = function()
  372. local Start = Weld.C1
  373. local X1, Y1, Z1 = Start:toEulerAnglesXYZ()
  374. local Stop = Stop
  375. local X2, Y2, Z2 = Stop:toEulerAnglesXYZ()
  376. if not Step then Step=0.1 end
  377. 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})
  378. end
  379. if a then coroutine.wrap(func)() else func() end
  380. end)
  381. end
  382. weld=function(p0,p1,c0)
  383. local w=Instance.new("Weld",p0)
  384. w.Part0=p0
  385. w.Part1=p1
  386. w.C0=c0
  387. return w
  388. end
  389. cp=function(parent,color,size,anchored,cancollide)
  390. local newp=Instance.new("Part",parent)
  391. newp.TopSurface='SmoothNoOutlines'
  392. newp.BottomSurface='SmoothNoOutlines'
  393. newp.FrontSurface='SmoothNoOutlines'
  394. newp.BackSurface='SmoothNoOutlines'
  395. newp.RightSurface='SmoothNoOutlines'
  396. newp.LeftSurface='SmoothNoOutlines'
  397. newp.FormFactor="Custom"
  398. newp.BrickColor=bc(color)
  399. newp.Size=size
  400. newp.Anchored=anchored
  401. newp.CanCollide=cancollide
  402. newp:BreakJoints()
  403. return newp
  404. end
  405.  
  406. initializeJoints=function()
  407. rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker'
  408. rabr.Position = torso.Position
  409. rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw'
  410. w = Instance.new("Weld",tube)
  411. w.Part0,w.Part1 = ch['Right Arm'],rabr
  412. w.C1 = CFrame.new(0,-.5,0)
  413. labr = cp(tube,'White',Vector3.new(1,1,1),false,false) labr.Transparency = 1 labr.Name='Locker'
  414. labr.Position = torso.Position
  415. lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = tube lw.Name = 'lw'
  416. ww = Instance.new("Weld",tube)
  417. ww.Part0,ww.Part1 = ch['Left Arm'],labr
  418. ww.C1 = CFrame.new(0,-.5,0)
  419. end
  420.  
  421. initializeJoints()
  422.  
  423. --[[ leg locks
  424. rabl = cp(tube,'White',Vector3.new(1,1,1),false,false) rabl.Transparency = 1 rabl.Name='Locker'
  425. rabl.Position = torso.Position
  426. rwl = Weld(rabl,torso,0.5,-1.5,0,0,0,0) rwl.Parent = tube rwl.Name = 'rwl'
  427. wl = Instance.new("Weld",tube)
  428. wl.Part0,wl.Part1 = ch['Right Leg'],rabl
  429. wl.C1 = CFrame.new(0,-.5,0)
  430. labl = cp(tube,'White',Vector3.new(1,1,1),false,false) labl.Transparency = 1 labl.Name='Locker'
  431. labl.Position = torso.Position
  432. lwl = Weld(labl,torso,-0.5,-1.5,0,0,0,0) lwl.Parent = tube lwl.Name = 'lwl'
  433. wwl = Instance.new("Weld",tube)
  434. wwl.Part0,wwl.Part1 = ch['Left Leg'],labl
  435. wwl.C1 = CFrame.new(0,-.5,0)
  436. ]]
  437. --weld(ch['HumanoidRootPart'],torso,cfn())
  438.  
  439.  
  440. local counter=Instance.new('ScreenGui',plr.PlayerGui)
  441. local frame=Instance.new('Frame',counter)
  442. frame.Size=UDim2.new(0.25,0,0.3,0)
  443.  
  444. frame.Position=UDim2.new(0.1,0,0.4,0)
  445. frame.BackgroundTransparency=1
  446.  
  447. local ammocounter=Instance.new('TextLabel',frame)
  448. ammocounter.Size=UDim2.new(1,0,0.3,0)
  449. ammocounter.Position=UDim2.new(0,0,0.2,0)
  450. ammocounter.BackgroundTransparency=1
  451. ammocounter.TextColor3=BrickColor.new('White').Color
  452. ammocounter.Font='SourceSansBold'
  453. ammocounter.FontSize='Size18'
  454. ammocounter.Text=''
  455. ammocounter.TextXAlignment='Left'
  456.  
  457.  
  458. local bg = Instance.new("BodyGyro",rootpart)
  459. bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  460. bg.P = 10000
  461. bg.D = 100
  462.  
  463.  
  464. cyl=function(prt)
  465. local c=int("CylinderMesh",prt)
  466. return c
  467. end
  468. blo=function(prt)
  469. local c=int("BlockMesh",prt)
  470. return c
  471. end
  472.  
  473. if laser then
  474. aLaser=cp(tube,'Really red',Vector3.new(0.2,0.2,0.2))
  475. aLaser.Transparency=1
  476. cyl(aLaser).Scale=Vector3.new(0.25,1,0.25)
  477. aLaser.Anchored=true
  478. end
  479.  
  480. local handle=cp(tube,primaryColor,Vector3.new(0.2,0.6,0.3))
  481. blo(handle).Scale=Vector3.new(1.15,0.9,1)
  482. 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)))
  483.  
  484. local framepiece1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.9))
  485. blo(framepiece1).Scale=Vector3.new(1.15,0.5,1)
  486. weld(handle,framepiece1,cfn(0,0.354,-0.3)*ang(mr(11.5),0,0))
  487.  
  488. local barrel=cp(tube,'Medium stone grey',Vector3.new(0.2,0.2,0.2))
  489. cyl(barrel).Scale=Vector3.new(0.7,1.2,0.7)
  490. weld(framepiece1,barrel,cfn(0,0.15,-0.1)*ang(mr(-90),0,0))
  491.  
  492. local sbarrel=cp(tube,'Really black',Vector3.new(0.2,0.3,0.2))
  493. cyl(sbarrel).Scale=Vector3.new(0.7,1.5,0.7)
  494. weld(barrel,sbarrel,cfn(0,0.35,0))
  495. local hole=cp(tube,'White',Vector3.new(0.2,0.2,0.2))
  496. hole.Transparency=1
  497. weld(sbarrel,hole,cfn(0,0.2,0))
  498. local flash=int('PointLight',hole)
  499. flash.Enabled=false
  500. flash.Range=10
  501. flash.Color=BrickColor.new('Neon orange').Color
  502.  
  503.  
  504. local slide1=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.4))
  505. slide1.CanCollide=false
  506. blo(slide1).Scale=Vector3.new(0.7,1,1.1)
  507. slideweld1=weld(framepiece1,slide1,cfn(0,0.15,0.23))
  508. slide1.Reflectance=slideReflectance
  509. slide1.Material=slideMaterial
  510.  
  511. local slide2=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.4))
  512. slide2.CanCollide=false
  513. blo(slide2).Scale=Vector3.new(0.7,1,1.1)
  514. slideweld2=weld(slide1,slide2,cfn(0,0,-0.666))
  515. slide2.Reflectance=slideReflectance
  516. slide2.Material=slideMaterial
  517.  
  518. local slideside1=cp(tube,secondaryColor,Vector3.new(0.2,0.2,1.1))
  519. slideside1.CanCollide=true
  520. blo(slideside1).Scale=Vector3.new(0.25,1,1)
  521. weld(slide1,slideside1,cfn(-0.09,0,-0.335))
  522. slideside1.Reflectance=slideReflectance
  523. slideside1.Material=slideMaterial
  524.  
  525. local slideside2=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.4))
  526. slideside2.CanCollide=true
  527. blo(slideside2).Scale=Vector3.new(0.25,1,1.1)
  528. weld(slide1,slideside2,cfn(0.09,0,0))
  529. slideside2.Reflectance=slideReflectance
  530. slideside2.Material=slideMaterial
  531.  
  532. local slideside3=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.3))
  533. slideside3.CanCollide=true
  534. blo(slideside3).Scale=Vector3.new(0.25,0.6,0.78)
  535. weld(slideside2,slideside3,cfn(0,-0.04,-0.335))
  536. slideside3.Reflectance=slideReflectance
  537. slideside3.Material=slideMaterial
  538.  
  539. local slideside4=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.4))
  540. blo(slideside4).Scale=Vector3.new(0.25,1,1.1)
  541. weld(slide2,slideside4,cfn(0.09,0,0))
  542. slideside4.Reflectance=slideReflectance
  543. slideside4.Material=slideMaterial
  544.  
  545. local mgs=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  546. blo(mgs).Scale=Vector3.new(1.15,0.425,0.245)
  547. weld(handle,mgs,cfn(0,-0.3,0.125))
  548.  
  549. --[[Trigger]]--
  550. local tp1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  551. blo(tp1).Scale=Vector3.new(0.6,0.1,0.8)
  552. weld(framepiece1,tp1,cfn(0,-0.22,0.13))
  553.  
  554. local tp2=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  555. blo(tp2).Scale=Vector3.new(0.6,0.1,1.19)
  556. weld(framepiece1,tp2,cfn(0,-0.14,-0.0265)*ang(mr(45),0,0))
  557.  
  558. local trigger1=cp(tube,'Really black',Vector3.new(0.2,0.2,0.2))
  559. blo(trigger1).Scale=Vector3.new(0.3,0.4,0.16)
  560. weld(framepiece1,trigger1,cfn(0,-0.07,0.09))
  561.  
  562. local trigger2=cp(tube,'Really black',Vector3.new(0.2,0.2,0.2))
  563. blo(trigger2).Scale=Vector3.new(0.3,0.3,0.16)
  564. weld(trigger1,trigger2,cfn(0,-0.06,-0.015)*ang(mr(30),0,0))
  565.  
  566.  
  567. --[[Magazine]]--
  568.  
  569. local magh=cp(tube,'Really black',Vector3.new(0.2,0.5,0.2))
  570. blo(magh).Scale=Vector3.new(0.6,1,1)
  571. local magweld=weld(handle,magh,cfn(0,-0.025,0))
  572.  
  573. local bottom=cp(tube,'Really black',Vector3.new(0.2,0.2,0.3))
  574. blo(bottom).Scale=Vector3.new(1.15,0.385,0.8)
  575. bottomweld=weld(magh,bottom,cfn(0,-0.28,-0.015))
  576.  
  577. if highCapMag then
  578. magweld:Destroy()
  579. magh.Size=Vector3.new(0.2,0.7,0.2)
  580. magweld=weld(handle,magh,cfn(0,-0.125,0))
  581. bottomweld:Destroy()
  582. bottomweld=weld(magh,bottom,cfn(0,-0.38,-0.015))
  583. magCapacity=magCapacity+23
  584. magAmmo=magAmmo+23
  585. end
  586.  
  587. --[[Sights]]--
  588. local backsight1=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
  589. blo(backsight1).Scale=Vector3.new(0.3,0.3,0.3)
  590. weld(slide1,backsight1,cfn(0.06,0.1,0.13))
  591. local backsight2=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
  592. blo(backsight2).Scale=Vector3.new(0.3,0.3,0.3)
  593. weld(slide1,backsight2,cfn(-0.06,0.1,0.13))
  594.  
  595. local frontsight=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
  596. blo(frontsight).Scale=Vector3.new(0.3,0.3,0.3)
  597. weld(slide1,frontsight,cfn(0,0.1,-0.85))
  598.  
  599. local dot1=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
  600. cyl(dot1).Scale=Vector3.new(0.1,0.31,0.1)
  601. weld(backsight1,dot1,cfn(0,0.014,0)*ang(mr(-90),0,0))
  602.  
  603. local dot2=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
  604. cyl(dot2).Scale=Vector3.new(0.1,0.31,0.1)
  605. weld(backsight2,dot2,cfn(0,0.014,0)*ang(mr(-90),0,0))
  606.  
  607. local dot3=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
  608. cyl(dot3).Scale=Vector3.new(0.1,0.31,0.1)
  609. weld(frontsight,dot3,cfn(0,0.014,0)*ang(mr(-90),0,0))
  610.  
  611. local ba=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.2))
  612. blo(ba).Scale=Vector3.new(1.15,0.5,1)
  613. weld(framepiece1,ba,cfn(0,0,-0.55))
  614. ba.Reflectance=slideReflectance
  615. ba.Material=slideMaterial
  616.  
  617. local weirdholethatpistolshave=cp(tube,'Really black', Vector3.new(0.2,0.2,0.2))
  618. cyl(weirdholethatpistolshave).Scale=Vector3.new(0.4,1.01,0.4)
  619. weld(ba,weirdholethatpistolshave,cfn(0,0,0)*ang(mr(-90),0,0))
  620.  
  621. --[[Tactical Rails]]--
  622.  
  623. local r1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  624. blo(r1).Scale=Vector3.new(1.15,0.2,0.25)
  625. weld(framepiece1,r1,cfn(0,-0.05,-0.17))
  626.  
  627. local r2=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  628. blo(r2).Scale=Vector3.new(1.15,0.2,0.25)
  629. weld(framepiece1,r2,cfn(0,-0.05,-0.27))
  630.  
  631. local r3=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
  632. blo(r3).Scale=Vector3.new(1.15,0.2,0.25)
  633. weld(framepiece1,r3,cfn(0,-0.05,-0.37))
  634.  
  635. if laser then
  636. local base=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.3))
  637. blo(base).Scale=Vector3.new(1.15,1,1)
  638. weld(r2,base,cfn(0,-0.05,0))
  639. basehole=cp(tube,'White',Vector3.new(0.2,0.2,0.2))
  640. cyl(basehole).Scale=Vector3.new(0.4,0.4,0.4)
  641. weld(base,basehole,cfn(0,0,-0.13)*ang(mr(-90),0,0))
  642. end
  643.  
  644. if silencer then
  645. local sil=cp(tube,'Really black',Vector3.new(0.2,0.3,0.2))
  646. fireSound.SoundId='rbxassetid://153230595'
  647. fireSound.Pitch=1
  648. cyl(sil).Scale=Vector3.new(0.94,1.8,0.94)
  649. weld(hole,sil,cfn(0,0.29,0))
  650. end
  651.  
  652. if grip then
  653. local base=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.3))
  654. blo(base).Scale=Vector3.new(1.15,1,1)
  655. weld(r2,base,cfn(0,-0.05,0))
  656. local hd=cp(tube,primaryColor,Vector3.new(0.2,0.6,0.2))
  657. cyl(hd)
  658. weld(base,hd,cfn(0,-0.3,0))
  659. crosshairSpread=3
  660. spreadint=spreadint-0.3
  661. end
  662.  
  663. --[[Test Functions]]--
  664.  
  665. local debounce=false
  666. local out=false
  667. local bs=false
  668. cockSlide=function() -- hahaha yes i know
  669. slideBackSound:Play()
  670. if magAmmo<1 and out==true and bs==false then
  671. wait()
  672. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  673. else
  674. for i=1,2 do
  675. wait()
  676. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  677. end
  678. end
  679. local ajar=false
  680. if magAmmo==1 then
  681. ajar=true
  682. end
  683. if magAmmo>0 then
  684. createShell()
  685. --magAmmo=magAmmo-1
  686. ammocounter.Text=''
  687. for i=1,magAmmo do
  688. ammocounter.Text=ammocounter.Text .. 'I'
  689. end
  690. end
  691. wait(0.15)
  692. slideForwardSound:Play()
  693. for i=1,2 do
  694. wait()
  695. slideweld1.C0=slideweld1.C0*cfn(0,0,-0.22)
  696. end
  697. if ajar==true then
  698. out=true
  699. slideweld1.C0=cfn(0,0.15,0.23)
  700. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  701. end
  702. end
  703.  
  704. --fx
  705. local firefx=cp(tube,'Neon orange',Vector3.new(0.7,1.1,0.7))
  706. firefx.Transparency=1
  707. local mesh=Instance.new('SpecialMesh',firefx)
  708. mesh.MeshType='Sphere'
  709. firefx.Material='Neon'
  710. weld(hole,firefx,cfn(0,1,0))
  711.  
  712. local smokefx=Instance.new('Smoke',hole)
  713. smokefx.Enabled=false
  714. barrel.CanCollide=true
  715.  
  716.  
  717.  
  718.  
  719. local oc = oc or function(...) return ... end
  720.  
  721. function ragJoint(hit,r,d)
  722. Spawn(oc(function()
  723. d = d or 0
  724. local rpar,r0,r1 = r.Parent,r.Part0,r.Part1
  725. if d > 0 then wait(d) end
  726. local p = hit:Clone()
  727. p:BreakJoints()
  728. p:ClearAllChildren()
  729. p.FormFactor = "Custom"
  730. p.Size = p.Size/2
  731. p.Transparency = 1
  732. p.CanCollide = true
  733. p.Name = "Colliduh"
  734. p.Parent = hit
  735. local w = Instance.new("Weld",p)
  736. w.Part0 = hit
  737. w.Part1 = p
  738. w.C0 = CFrame.new(0,-p.Size.Y/2,0)
  739. local rot = Instance.new("Rotate",rpar)
  740. rot.Name = r.Name
  741. rot.Part0 = r0
  742. rot.Part1 = r1
  743. rot.C0 = r.C0
  744. rot.C1 = r.C1
  745. r0.Velocity = Vector3.new()
  746. r1.Velocity = Vector3.new()
  747. r:Destroy()
  748. end))
  749. end
  750.  
  751.  
  752. createShell=function()
  753. local shell=cp(tube,'Deep orange',Vector3.new(0.2,0.3,0.2))
  754. shell.CanCollide=true
  755. shell.Reflectance=0.3
  756. cyl(shell)
  757. shell.CFrame=barrel.CFrame*ang(mr(-90),0,0)
  758. magAmmo=magAmmo-1
  759. ammocounter.Text=''
  760. for i=1,magAmmo do
  761. ammocounter.Text=ammocounter.Text .. 'I'
  762. end
  763. game.Debris:AddItem(shell,3)
  764. end
  765.  
  766. reloadPistol=function()
  767. local current=magAmmo
  768. Tween(lw,cfn())
  769. Tween(rw,cfn()*ang(mr(-102),0,0))
  770. wait(0.4)
  771. releaseSound:Play()
  772. bottom.Transparency=1
  773. magh.Transparency=1
  774. local mag1=magh:clone()
  775. mag1.Transparency=0
  776. mag1.Weld:Destroy''
  777. local mag2=bottom:clone()
  778. mag2.Transparency=0
  779. mag1:BreakJoints''
  780. mag2:BreakJoints''
  781. local bm1=mag1:clone()
  782. local bm2=mag2:clone()
  783. mag1.Parent=tube
  784. mag2.Parent=tube
  785. mag1.CFrame=magh.CFrame
  786. weld(mag1,mag2,cfn(0,-0.28,-0.015))
  787. magAmmo=0
  788. ammocounter.Text=''
  789. for i=1,magAmmo do
  790. ammocounter.Text=ammocounter.Text .. 'I'
  791. end
  792. wait()
  793. mag1.CanCollide=true
  794. mag2.CanCollide=true
  795. game.Debris:AddItem(mag1,2)
  796. game.Debris:AddItem(mag2,2)
  797. wait(0.1)
  798. Tween(lw,cfn()*ang(mr(25),0,0))
  799. bm1.Parent=tube
  800. bm2.Parent=tube
  801. weld(bm1,bm2,cfn(0,-0.28,-0.015))
  802. local fa=weld(ch['Left Arm'],bm1,cfn(0,-1.1,0)*ang(mr(-90),0,0))
  803. wait(0.1)
  804. Tween(lw,cfn(0,1.4,0)*ang(mr(-109),mr(60),mr(10)),0.07)
  805. wait(0.25)
  806. magazinelockSound:Play()
  807. wait()
  808. -- reloadSound:Play()
  809. fa:Destroy''
  810. bm1:Destroy''
  811. bm2:Destroy''
  812. bottom.Transparency=0
  813. magh.Transparency=0
  814. local totalcap=0
  815. if current<1 then --none in chamber reload
  816. --slideweld1.C0=cfn(0,0,0.45)
  817. Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0))
  818. Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(35),0))
  819. wait(0.1)
  820. spawn(function()
  821. cockSlide()
  822. end)
  823. Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(55),0))
  824. wait(0.3)
  825. totalcap=magCapacity
  826. else
  827. totalcap=magCapacity+1
  828. end
  829. magAmmo=totalcap
  830. out=false
  831. ammocounter.Text=''
  832. for i=1,magAmmo do
  833. ammocounter.Text=ammocounter.Text .. 'I'
  834. end
  835. restorePosition()
  836. end
  837.  
  838. firePistol=function()
  839. switchIco(currentIco+crosshairSpread)
  840. if not jammed and not out then
  841. spread=spread+spreadint
  842. end
  843. print(spread)
  844. fireSound.Pitch=math.random(math.random(fireSound.Pitch-0.2,fireSound.Pitch-0.1),math.random(fireSound.Pitch,fireSound.Pitch+0.1))
  845. if magAmmo>0 and jammed==false then
  846. local ajar=false
  847. if magAmmo==1 then
  848. ajar=true
  849. end
  850. user=ch
  851. 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)
  852. local hit, position = game.Workspace:FindPartOnRay(ray, user)
  853. if hit then
  854. if hit.Transparency>0.285 and hit:GetMass()<3000 and hit.Parent.className~='Hat' then
  855. local temps=glassBreakSound:clone()
  856. temps.Parent=hit
  857. temps.Pitch=math.random(math.random(temps.Pitch-0.2,temps.Pitch-0.1),math.random(temps.Pitch,temps.Pitch+0.1))
  858. temps:Play''
  859. start_fragmentation(position,.25)
  860. end
  861. if tostring(hit.Material)=='Enum.Material.Wood' and hit.Transparency<0.05 then
  862. local temps=woodImpact:clone()
  863. temps.Volume=1
  864. temps.Pitch=math.random(math.random(temps.Pitch-0.2,temps.Pitch-0.1),math.random(temps.Pitch,temps.Pitch+0.1))
  865. temps.Parent=hit
  866. temps:Play''
  867. start_fragmentation(position,.15)
  868. end
  869. ypcall(function()
  870. if hit and hit.Parent and hit.Parent:findFirstChild'Humanoid' then
  871. local temps=fleshImpact:clone()
  872. temps.Parent=hit
  873. temps:Play()
  874. if hit.Name~='Head' then
  875. if pAmmunition==true then
  876. hit.Parent.Humanoid:TakeDamage(math.random(30,65))
  877. else
  878. hit.Parent.Humanoid:TakeDamage(math.random(10,24))
  879. end
  880. local guy=hit.Parent
  881. if guy.Name~='TheDarkRevenant' then
  882. for i,v in pairs(guy:GetChildren()) do
  883. if v.className=='Hat' then
  884. v.Handle:BreakJoints()
  885. end
  886. local r = guy.Torso:FindFirstChild(v.Name:gsub("Arm","Shoulder"):gsub("Leg","Hip"))
  887. if v:IsA("BasePart") and r then
  888. ragJoint(v,r,.1)
  889. elseif v:IsA("Humanoid") then
  890. spawn(function()
  891. wait(0.5)
  892. v.PlatformStand = true
  893. v.Changed:connect(function()
  894. v.PlatformStand = true
  895. end)
  896. end)
  897. end
  898. end
  899. end
  900.  
  901. else
  902. if hit.Parent.Name~='TheDarkRevenant' then
  903. hit.Parent:BreakJoints()
  904. end
  905. end
  906. end
  907.  
  908. if hit.Parent.className=='Hat' then
  909. hit.CanCollide=true
  910. hit:BreakJoints()
  911. hit.Velocity=m.Hit.p*5
  912. end
  913. end)
  914. end
  915. if m.Target then
  916. local p = Instance.new("Part")
  917. p.formFactor = "Custom"
  918. p.Size = Vector3.new(0.5,0.5,0.5)
  919. p.Transparency = 1
  920. p.CanCollide = false
  921. p.Locked = true
  922. p.CFrame = CFrame.new(position.x,position.y,position.z)--mouse.Target.CFrame+(mouse.Hit.p-mouse.Target.Position)
  923. local w = Instance.new("Weld")
  924. w.Part0 = mouse.Target
  925. w.Part1 = p
  926. w.C0 = mouse.Target.CFrame:inverse()
  927. w.C1 = p.CFrame:inverse()
  928. w.Parent = p
  929. local d = Instance.new("Decal")
  930. d.Parent = p
  931. d.Face = mouse.TargetSurface
  932. d.Texture = 'rbxassetid://' .. tostring(bulletholes[math.random(#bulletholes)]-2)
  933. p.Parent = tube
  934. game.Debris:AddItem(p,6)
  935. end
  936. if recoil==true then
  937. cam:SetRoll(math.random(-2,2))
  938. cam:TiltUnits(0.501)
  939. end
  940. local th=cp(tube,"Really black",Vector3.new(1,1,1))
  941. th.CanCollide=false
  942. th.Anchored=true
  943. th.CFrame=CFrame.new(position.x,position.y,position.z)
  944. local spm=Instance.new('SpecialMesh',th)
  945. spm.MeshType='Sphere'
  946. spm.Scale=Vector3.new(0.05,0.05,0.05)
  947. spawn(function()
  948. for i=1,5 do
  949. wait()
  950. spm.Scale=spm.Scale+Vector3.new(0.16,0.16,0.16)
  951. th.Transparency=th.Transparency+0.2
  952. end
  953. th:Destroy()
  954. end)
  955. fireSound:Play()
  956. spawn(function()
  957. firefx.Transparency=0
  958. wait()
  959. firefx.Transparency=1
  960. end)
  961. spawn(function()
  962. flash.Enabled=true
  963. for i=1,2 do
  964. wait()
  965. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  966. end
  967. flash.Enabled=false
  968. createShell()
  969. for i=1,2 do
  970. wait()
  971. slideweld1.C0=slideweld1.C0*cfn(0,0,-0.22)
  972. end
  973. slideweld1.C0=cfn(0,0.15,0.23)
  974. if ajar==true then
  975. out=true
  976. slideweld1.C0=cfn(0,0.15,0.23)
  977. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  978. end
  979. end)
  980. ammocounter.Text=''
  981. for i=1,magAmmo do
  982. ammocounter.Text=ammocounter.Text .. 'I'
  983. end
  984. wait()
  985. Tween(rw,cfn(0,0.7,0)*ang(mr(-100),mr(-30),0),0.62)
  986. if not grip then
  987. Tween(lw,cfn(0,0.7,0)*ang(mr(-100),mr(30),0),0.62)
  988. else
  989. Tween(lw,cfn(0,1.3,0)*ang(mr(-100),mr(30),0),0.62)
  990. end
  991. wait(0.065)
  992. restorePosition(0.3)
  993. else
  994. if magAmmo<1 then
  995. slideweld1.C0=cfn(0,0.15,0.23)
  996. slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
  997. end
  998. emptySound:Play()
  999. end
  1000. if math.random(jamRate)==jamRate and magAmmo>0 then
  1001. jammed=true
  1002. end
  1003. end
  1004.  
  1005. debounced=function()
  1006. if sheathed==false and debounce==false then
  1007. return true
  1008. end
  1009. end
  1010.  
  1011. mouse.Button1Down:connect(function()
  1012. if debounced() then
  1013. if automatic==false then
  1014. debounce=true
  1015. firePistol()
  1016. debounce=false
  1017. else
  1018. heldDown=true
  1019. firePistol()
  1020. end
  1021. end
  1022. end)
  1023.  
  1024. mouse.Button1Up:connect(function()
  1025. heldDown=false
  1026. end)
  1027.  
  1028. sheathGun=function()
  1029. ammocounter.Visible=false
  1030. if laser then
  1031. laserEnabled=false
  1032. aLaser.Transparency=1
  1033. end
  1034. Tween(rw,cfn())
  1035. Tween(lw,cfn())
  1036. wait(0.1)
  1037. mw:Destroy''
  1038. mw=nil
  1039. mw=weld(tor,handle,cfn(1.11,-1.09,0)*ang(mr(-111.5),0,0))
  1040. labr:Destroy()
  1041. rabr:Destroy()
  1042. bg.maxTorque=Vector3.new()
  1043. sheathed=true
  1044. end
  1045.  
  1046. unsheathGun=function()
  1047. ammocounter.Visible=true
  1048. mw:Destroy''
  1049. mw=nil
  1050. initializeJoints()
  1051. 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)))
  1052. restorePosition()
  1053. bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  1054. sheathed=false
  1055. end
  1056.  
  1057. laserEnabled=false
  1058.  
  1059. mouse.KeyDown:connect(function(key)
  1060. if key=='r' and debounced() then
  1061. debounce=true
  1062. reloadPistol()
  1063. debounce=false
  1064. elseif key=='f' and debounced() then
  1065. debounce=true
  1066. bs=true
  1067. Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0))
  1068. Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(35),0))
  1069. wait(0.1)
  1070. spawn(function()
  1071. cockSlide()
  1072. end)
  1073. Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(55),0))
  1074. wait(0.3)
  1075. jammed=false
  1076. restorePosition()
  1077. bs=false
  1078. debounce=false
  1079. elseif key=='l' and debounced() then
  1080. if not laserEnabled then
  1081. laserEnabled=true
  1082. aLaser.Transparency=0.35
  1083. else
  1084. laserEnabled=false
  1085. aLaser.Transparency=1
  1086. end
  1087. end
  1088. end)
  1089.  
  1090. restorePosition=function(speed)
  1091. if not grip then
  1092. Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0),speed)
  1093. Tween(lw,cfn(0,0.7,0)*ang(mr(-90),mr(30),0),speed)
  1094. else
  1095. Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0),speed)
  1096. Tween(lw,cfn(0,1.3,0)*ang(mr(-90),mr(30),0),speed)
  1097. end
  1098. end
  1099.  
  1100. hopper.Selected:connect(function()
  1101. unsheathGun()
  1102. end)
  1103.  
  1104. hopper.Deselected:connect(function()
  1105. sheathGun()
  1106. end)
  1107.  
  1108. game:service'RunService'.RenderStepped:connect(function()
  1109. bg.cframe = CFrame.new(rootpart.Position,mouse.Hit.p*Vector3.new(1,0,1)+rootpart.Position*Vector3.new(0,1,0))
  1110. if laserEnabled==true then
  1111. local user=ch
  1112. local ray = Ray.new(hole.CFrame.p, (m.Hit.p - hole.CFrame.p).unit*300)
  1113. local hit, position = game.Workspace:FindPartOnRay(ray, user)
  1114. local distance = (position - basehole.CFrame.p).magnitude
  1115. aLaser.Size=Vector3.new(0.2,distance,0.2)
  1116. aLaser.CFrame=CFrame.new(position, basehole.CFrame.p) * CFrame.new(0, 0, -distance/2) * ang(mr(-90),0,0)
  1117. end
  1118. for _,v in pairs(tweenTable) do
  1119. if v.Weld.C1==v.Stop then
  1120. table.remove(tweenTable,_)
  1121. else
  1122. if v.th<0.9 then
  1123. v.th=v.th+v.Step
  1124. i=v.th
  1125. v.Weld.C1 = CFrame.new( (v.Start.p.X * (1 - i)) + (v.Stop.p.X * i),
  1126. (v.Start.p.Y * (1 - i)) + (v.Stop.p.Y * i),
  1127. (v.Start.p.Z * (1 - i)) + (v.Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ(
  1128. (v.X1 * (1 - i)) + (v.X2 * i), (v.Y1 * (1 - i)) + (v.Y2 * i),
  1129. (v.Z1 * (1 - i)) + (v.Z2 * i) )
  1130. else
  1131. v.Weld.C1 = v.Stop
  1132. end
  1133. end
  1134. end
  1135. end)
  1136. for i=1,magAmmo do
  1137. ammocounter.Text=ammocounter.Text .. 'I'
  1138. end
  1139.  
  1140. sheathGun()
  1141.  
  1142. spawn(function()
  1143. while wait(0.07) do
  1144. if heldDown==true then
  1145. spawn(function()
  1146. firePistol()
  1147. end)
  1148. end
  1149. end
  1150. end)
  1151. m.TargetFilter=tube
  1152.  
  1153. while wait(0.03) do
  1154. if spread>1 then
  1155. spread=spread-spreadint/4
  1156. end
  1157. if spread<1 then
  1158. spread=1
  1159. end
  1160. if currentIco>2 then
  1161. switchIco(currentIco-1)
  1162. end
  1163. end
  1164.  
  1165. --hl/https://httpget-inumeration.c9.io/mp45.lua
  1166. --local/game.Players.Conmiro:Destroy''
Advertisement
Add Comment
Please, Sign In to add comment