Advertisement
gabiplayz

lord tachanka

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