Advertisement
yoinkydoodlewastaken

gun.

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