Advertisement
Beeish

Untitled

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