Advertisement
brianspy

Untitled

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