SomeRandomD00D

Mafia???

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