Sewab

Untitled

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