Advertisement
yaay

Untitled

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