Advertisement
nicholasXPG

Untitled

Oct 11th, 2016
3,116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.47 KB | None | 0 0
  1. local animations = {
  2. requip = {
  3. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
  4. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-15)) * CFrame.new(1.5, -.5, 0);
  5. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(210), 0, math.rad(-40)) * CFrame.new(1.5, -.5, 0);
  6. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
  7. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.new(1.5, -.5, 0);
  8. };
  9. lequip = {
  10. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
  11. };
  12. runequip = {
  13. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
  14. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-15)) * CFrame.new(1.5, -.5, 0);
  15. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(210), 0, math.rad(-40)) * CFrame.new(1.5, -.5, 0);
  16. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
  17. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.new(1.5, -.5, 0);
  18. CFrame.new(1.5, 0, 0);
  19. };
  20. rshoot = {
  21. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(170), 0, 0) * CFrame.new(1.5, -.5, 0);
  22. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.new(1.5, -.5, 0);
  23. };
  24. lshoot = {
  25. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(170), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
  26. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
  27. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(80)) * CFrame.new(-.5, -.35, 0);
  28. CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
  29. };
  30. }
  31. local player = game:GetService("Players").LocalPlayer
  32. local pmouse = player:GetMouse()
  33. local char = player.Character
  34. local bin = Instance.new("HopperBin", player.Backpack)
  35. local barrelsize = .3
  36. local handleweld = nil
  37. local temp = true
  38. local etemp = true
  39. bin.Name = "L96A1 Magnum"
  40.  
  41.  
  42. function weld(part0, part1, c0, c1, parent)
  43. local w = Instance.new("Weld", parent)
  44. w.Part0 = part0
  45. w.Part1 = part1
  46. w.C0 = c0
  47. w.C1 = c1
  48. w.Name = "NewWeld"
  49. return w
  50. end
  51.  
  52.  
  53. function interpolateCFrame(cf1, cf2)
  54. local t1 = {cf1:components()}
  55. local t2 = {cf2:components()}
  56. local newcf = {}
  57. for i, v in pairs(t1) do
  58. local dif = t2[i] - v
  59. if i < 4 then
  60. local newValue = nil
  61. if math.abs(dif) < .1 then
  62. newValue = t2[i]
  63. else
  64. newValue = v + ((dif/math.abs(dif)) * .1)
  65. end
  66. newcf[i] = newValue
  67. else
  68. local newValue = nil
  69. if math.abs(dif) < .1 then
  70. newValue = t2[i]
  71. else
  72. newValue = v + ((dif/math.abs(dif)) * .1)
  73. end
  74. newcf[i] = newValue
  75. end
  76. end
  77. return CFrame.new(unpack(newcf))
  78. end
  79.  
  80.  
  81. function prop(name, sx, sy, sz, px, py, pz, anc, canc, col, par, mesh, meshtype, scalex, scaley, scalez, meshid, textureid)
  82. local part = Instance.new("Part", par)
  83. part.Name = name
  84. part.TopSurface = 0
  85. part.BottomSurface = 0
  86. part.formFactor = 3
  87. part.Size = Vector3.new(sx, sy, sz)
  88. part.Position = Vector3.new(px, py, pz)
  89. part.Anchored = anc
  90. part.CanCollide = canc
  91. part.BrickColor = BrickColor.new(col)
  92. if mesh then
  93. local m = Instance.new("SpecialMesh", part)
  94. m.MeshType = meshtype
  95. m.MeshId = meshid
  96. m.Scale = Vector3.new(scalex, scaley, scalez)
  97. m.TextureId = textureid
  98. end
  99. return part
  100. end
  101.  
  102.  
  103. function fade(part, speed)
  104. for i = part.Transparency, 1, speed do
  105. part.Transparency = i
  106. wait()
  107. end
  108. part:Destroy()
  109. end
  110.  
  111.  
  112. function clearWelds(par)
  113. for i, v in pairs(par:GetChildren()) do
  114. if v.Name == "NewWeld" and v:IsA("Weld") then
  115. v:Destroy()
  116. end
  117. end
  118. end
  119.  
  120.  
  121. function sound(pitch, id, par)
  122. local s = Instance.new("Sound", par)
  123. s.Pitch = pitch
  124. s.SoundId = id
  125. return s
  126. end
  127.  
  128.  
  129. function traceRay(pos, pos2, col, trans)
  130. local distance = (pos - pos2).magnitude
  131. local trace = Instance.new("Part", char)
  132. trace.Anchored = true
  133. trace.CanCollide = false
  134. trace.TopSurface = 0
  135. trace.BottomSurface = 0
  136. trace.formFactor = 3
  137. trace.Size = Vector3.new(.2, .2, distance)
  138. trace.BrickColor = BrickColor.new(col)
  139. trace.Transparency = trans
  140. trace.CFrame = CFrame.new(pos2, pos) * CFrame.new(0, 0, -distance/2)
  141. return trace
  142. end
  143.  
  144.  
  145. clearWelds(char.Torso)
  146. local back1 = prop("Part1", .1, .7, .5, 0, 0, 0, false, false, "Black", char, false)
  147. local back1weld = weld(char.Torso, back1, CFrame.new(1, -2, .6) * CFrame.Angles(math.rad(90), math.rad(20), math.rad(90)), CFrame.new(), char.Torso)
  148. local back2 = prop("Part2", .1, .2, .1, 0, 0, 0, false, false, "Grime", char, false)
  149. local back2weld = weld(back1, back2, CFrame.new(0, -.25, -.35), CFrame.new(), char.Torso)
  150. local back3 = prop("Part3", .1, .5, 1, 0, 0, 0, false, false, "Grime", char, false)
  151. local back3weld = weld(back1, back3, CFrame.new(0, .1, -.75), CFrame.new(), char.Torso)
  152. local back4 = prop("Part4", .1, .1, 1, 0, 0, 0, false, false, "Grime", char, false)
  153. local back4weld = weld(back3, back4, CFrame.new(0, .3, 0), CFrame.new(), char.Torso)
  154. local back5 = prop("Part5", .1, .1, .7, 0, 0, 0, false, false, "Grime", char, false)
  155. local back5weld = weld(back1, back5, CFrame.new(0, .4, -1.6), CFrame.new(), char.Torso)
  156. local trigger1 = prop("Part6", .1, .1, .6, 0, 0, 0, false, false, "Grime", char, false)
  157. local trigger1weld = weld(back4, trigger1, CFrame.new(0, -.6, -.4) * CFrame.Angles(-math.rad(30), 0, 0), CFrame.new(), char.Torso)
  158. local trigger2 = prop("Part7", .1, .1, .5, 0, 0, 0, false, false, "Grime", char, false)
  159. local trigger2weld = weld(back4, trigger2, CFrame.new(0, -.675, -.8) * CFrame.Angles(math.rad(15), 0, 0), CFrame.new(), char.Torso)
  160. local trigger3 = prop("Part8", .1, .1, .7, 0, 0, 0, false, false, "Grime", char, false)
  161. local trigger3weld = weld(back4, trigger3, CFrame.new(0, -.4, -.95) * CFrame.Angles(math.rad(90), 0, 0), CFrame.new(), char.Torso)
  162. local middle1 = prop("Part9", .1, .1, 1, 0, 0, 0, false, false, "Black", char, true, "Brick", .1, .0, .1, "", "") -- dis
  163. local middle1weld = weld(back5, middle1, CFrame.new(0, .05, -.8), CFrame.new(), char.Torso)
  164. local trigframe = prop("Part10", .1, .3, .3, 0, 0, 0, false, false, "Grime", char, true, "FileMesh", .3, .3, .3, "http://www.roblox.com/asset/?id=3270017", "")
  165. local trigframeweld = weld(back5, trigframe, CFrame.new(0, -.2, -.3) * CFrame.Angles(0, math.rad(90), 0), CFrame.new(), char.Torso)
  166. local middle2 = pVoidacity's Script Builder (Place 2)rop("Part11", .1, .3, 2, 0, 0, 0, false, false, "Grime", char, false)
  167. local middle2weld = weld(middle1, middle2, CFrame.new(0, -.1, -.4), CFrame.new(), char.Torso)
  168. local barrel = prop("Part12", .1, .1, 4, 0, 0, 0, false, false, "Black", char, true, "Brick", .5, .5, 1, "", "")
  169. local barrelweld = weld(middle1, barrel, CFrame.new(0, -.05, -2), CFrame.new(), char.Torso)
  170. local barrel2 = prop("Part13", barrelsize, 2, barrelsize, 0, 0, 0, false, false, "Black", char, false) Instance.new("CylinderMesh", barrel2)
  171. local barrel2weld = weld(barrel, barrel2, CFrame.new(0, 0, -2.5) * CFrame.Angles(math.rad(90), 0, 0), CFrame.new(), char.Torso)
  172. local scope1 = prop("Part14", .1, .2, .1, 0, 0, 0, false, false, "Black", char, true, "Brick", .5, .5, .5, "", "")
  173. local scope1weld = weld(middle1, scope1, CFrame.new(0, .1, .25), CFrame.new(), char.Torso)
  174. local scope2 = prop("Part14", .1, .2, .1, 0, 0, 0, false, false, "Black", char, true, "Brick", .5, .5, .5, "", "")
  175. local scope2weld = weld(middle1, scope2, CFrame.new(0, .1, -.25), CFrame.new(), char.Torso)
  176. local scope3 = prop("Part15", .1, 1.5, .1, 0, 0, 0, false, false, "Black", char, false) Instance.new("CylinderMesh", scope3)
  177. local scope3weld = weld(middle1, scope3, CFrame.new(0, .2, 0) * CFrame.Angles(math.rad(90), 0, 0), CFrame.new(), char.Torso)
  178. local scope4 = prop("Part16", .2, .3, .2, 0, 0, 0, false, false, "Black", char, true, "FileMesh", .2, .3, .2, "http://www.roblox.com/asset/?id=1033714", "")
  179. local scope4weld = weld(middle1, scope4, CFrame.new(0, .2, .7) * CFrame.Angles(math.rad(270), 0, 0), CFrame.new(), char.Torso)
  180. local scope5 = prop("Part17", .3, .35, .3, 0, 0, 0, false, false, "Black", char, true, "FileMesh", .3, .35, .3, "http://www.roblox.com/asset/?id=1033714", "")
  181. local scope5weld = weld(middle1, scope5, CFrame.new(0, .2, -.7) * CFrame.Angles(math.rad(-270), 0, 0), CFrame.new(), char.Torso)
  182. local rarmweld = weld(char.Torso, nil, CFrame.new(1.5, 0, 0), CFrame.new(), char.Torso)
  183. local larmweld = weld(char.Torso, nil, CFrame.new(-1.5, 0, 0), CFrame.new(), char.Torso)
  184. local gyro = Instance.new("BodyGyro", char.Torso)
  185. gyro.P = 10000
  186. gyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  187. pmouse.Move:connect(function()
  188. gyro.cframe = CFrame.new(char.Torso.Position, Vector3.new(pmouse.Hit.p.X, char.Torso.Position.Y, pmouse.Hit.p.Z))
  189. end)
  190.  
  191.  
  192.  
  193.  
  194. function onEquip(mouse)
  195. repeat wait() until etemp and temp
  196. etemp = false
  197. rarmweld.Part1 = char["Right Arm"]
  198. local frame = 1
  199. coroutine.wrap(function()
  200. while rarmweld and animations.requip[frame] do
  201. rarmweld.C0 = interpolateCFrame(rarmweld.C0, animations.requip[frame])
  202. if rarmweld.C0 == animations.requip[frame] then
  203. frame = frame + 1
  204. else
  205. wait()
  206. end
  207. end
  208. end)()
  209. repeat wait() until frame == 3
  210. back1weld.Part0 = nil
  211. handleweld = weld(char["Right Arm"], back1, CFrame.new(-.5, 1, -.3) * CFrame.Angles(math.rad(270), 0, 0), CFrame.new(), char.Torso)
  212. repeat wait() until frame == 5
  213. larmweld.Part1 = char["Left Arm"]
  214. local frame2 = 1
  215. coroutine.wrap(function()
  216. while larmweld and animations.lequip[frame2] do
  217. larmweld.C0 = interpolateCFrame(larmweld.C0, animations.lequip[frame2])
  218. if larmweld.C0 == animations.lequip[frame2] then
  219. frame2 = frame2 + 1
  220. else
  221. wait()
  222. end
  223. end
  224. etemp = true
  225. end)()
  226. repeat wait() until frame == 6
  227.  
  228.  
  229.  
  230.  
  231. mouse.Button1Down:connect(function()
  232. if not temp then return end
  233. temp = false
  234. local frame3 = 1
  235. coroutine.wrap(function()
  236. while rarmweld and animations.rshoot[frame3] do
  237. rarmweld.C0 = interpolateCFrame(rarmweld.C0, animations.rshoot[frame3])
  238. if rarmweld.C0 == animations.rshoot[frame3] then
  239. frame3 = frame3 + 1
  240. else
  241. wait()
  242. end
  243. end
  244. end)()
  245. local frame4 = 1
  246. coroutine.wrap(function()
  247. while larmweld and animations.lshoot[frame4] do
  248. larmweld.C0 = interpolateCFrame(larmweld.C0, animations.lshoot[frame4])
  249. if larmweld.C0 == animations.lshoot[frame4] then
  250. frame4 = frame4 + 1
  251. else
  252. wait()
  253. end
  254. end
  255. wait(.1)
  256. temp = true
  257. end)()
  258. local ray = Ray.new(barrel2.Position, (mouse.Hit.p - barrel2.Position).unit * 500)
  259. sound(1, "http://roblox.com/asset/?id=10209875", barrel2):play()
  260. local hit, pos = workspace:FindPartOnRay(ray, char)
  261. if hit and hit.Parent:FindFirstChild("Humanoid") then
  262. local dmg = math.random(70, 100)
  263. if hit.Name ~= "Head" then
  264. hit.Parent.Humanoid:TakeDamage(dmg)
  265. hit.Parent.Humanoid.Sit = true
  266. else
  267. hit.Parent:BreakJoints()
  268. sound(1, "http://www.roblox.com/asset/?id=1876552", workspace):play()
  269. end
  270. if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) == nil then return end
  271. local bl = Instance.new("Part", workspace)
  272. bl.Name = "Blood"
  273. bl.BrickColor = BrickColor.new("Really red")
  274. bl.FormFactor = 3
  275. bl.TopSurface = 0
  276. bl.BottomSurface = 0
  277. bl.Size = Vector3.new(1, .1, 1)
  278. bl.Position = hit.Parent.Head.Position + Vector3.new(0, 3, 0)
  279. local bbg = Instance.new("BillboardGui", bl)
  280. bbg.Adornee = bl
  281. bbg.Size = UDim2.new(1, 0, 1, 0)
  282. bbg.StudsOffset = Vector3.new(0, 1, 0)
  283. local txt = Instance.new("TextLabel", bbg)
  284. txt.Position = UDim2.new(0.5, 0, 0.5, 0)
  285. txt.FontSize = "Size14"
  286. txt.TextColor3 = Color3.new(1, 1, 1)
  287. txt.Text = hit.Name ~= "Head" and dmg or "HEADSHOT"
  288. coroutine.wrap(fade)(bl, 0.005)
  289. end
  290. if hit and hit.Parent:IsA("Hat") then
  291. hit:BreakJoints()
  292. end
  293. Spawn(function()
  294. local tr = traceRay(barrel2.Position, pos, "White", .5)
  295. fade(tr, .01)
  296. end)
  297. repeat wait() until frame4 == 3
  298. sound(1, "http://roblox.com/asset/?id=10209881", middle2):play()
  299. end)
  300.  
  301.  
  302.  
  303.  
  304. end
  305.  
  306.  
  307. function onUnequip()
  308. repeat wait() until etemp and temp
  309. etemp = false
  310. local frame = 1
  311. coroutine.wrap(function()
  312. while rarmweld and animations.runequip[frame] do
  313. rarmweld.C0 = interpolateCFrame(rarmweld.C0, animations.runequip[frame])
  314. if rarmweld.C0 == animations.runequip[frame] then
  315. frame = frame + 1
  316. else
  317. wait()
  318. end
  319. end
  320. etemp = true
  321. end)()
  322. coroutine.wrap(function()
  323. while larmweld do
  324. larmweld.C0 = interpolateCFrame(larmweld.C0, CFrame.new(-1.5, 0, 0))
  325. if larmweld.C0 == CFrame.new(-1.5, 0, 0) then
  326. break
  327. else
  328. wait()
  329. end
  330. end
  331. end)()
  332. repeat wait() until frame == 4
  333. handleweld:Remove()
  334. back1weld:Remove()
  335. back1weld = weld(char.Torso, back1, CFrame.new(1, -2, .6) * CFrame.Angles(math.rad(90), math.rad(20), math.rad(90)), CFrame.new(), char.Torso)
  336. repeat wait() until frame == 7
  337. rarmweld.Part1 = nil
  338. larmweld.Part1 = nil
  339. end
  340.  
  341.  
  342. bin.Selected:connect(onEquip)
  343. bin.Deselected:connect(onUnequip)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement