Advertisement
benli45

Untitled

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