SomeRandomD00D

Untitled

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