coolnoor1

Pocket Pistol

Mar 16th, 2013
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.36 KB | None | 0 0
  1. --==Made by LuisPambid==--
  2.  
  3. local player=game.Players.LocalPlayer
  4. local char=player.Character
  5. repeat wait() until player and char
  6. local torso=char.Torso
  7. local head=char.Head
  8. local human=char.Humanoid
  9. local arm={Left=char["Left Arm"], Right=char["Right Arm"]}
  10. local leg={Left=char["Left Leg"], Right=char["Right Leg"]}
  11. local joints={LeftShoulder=torso["Left Shoulder"], RightShoulder=torso["Right Shoulder"], LeftHip=torso["Left Hip"], RightHip=torso["Right Hip"]}
  12. joints.LeftShoulder.Part0=torso
  13. joints.RightShoulder.Part0=torso
  14. joints.LeftHip.Part0=torso
  15. joints.RightHip.Part0=torso
  16. local c=function(f) Spawn(f) end
  17. local p=function(f) pcall(f) end
  18. local add={
  19. Part=function(par, a, c, col, t, s, cf, ms)
  20. local p=Instance.new("Part", par) pcall(function() p.TopSurface="Smooth" p.BottomSurface="Smooth" p.formFactor="Custom" p.Anchored=a p.CanCollide=c p.BrickColor=BrickColor.new(col) p.Transparency=t p.Size=s p.CFrame=cf or CFrame.new() end)
  21. local m=Instance.new("BlockMesh", p) pcall(function() m.Scale=ms or Vector3.new(1, 1, 1) end)
  22. return p
  23. end,
  24. Wedge=function(par, a, c, col, t, s, cf, ms)
  25. local p=Instance.new("WedgePart", par) pcall(function() p.TopSurface="Smooth" p.BottomSurface="Smooth" p.formFactor="Custom" p.Anchored=a p.CanCollide=c p.BrickColor=BrickColor.new(col) p.Transparency=t p.Size=s p.CFrame=cf or CFrame.new() end)
  26. local m=Instance.new("SpecialMesh", p) pcall(function() m.Scale=ms or Vector3.new(1, 1, 1) m.MeshType="Wedge" end)
  27. return p
  28. end,
  29. Gui=function(ins, par, bc, bg, tc, fs, text, t, s, pos)
  30. local g=Instance.new(ins, par) pcall(function() g.BorderColor=BrickColor.new(bc) g.BackgroundColor=BrickColor.new(bg) g.TextColor=BrickColor.new(tc) g.FontSize=fs g.Font="ArialBold" g.Text=text g.Transparency=t g.Size=s g.Position=pos end)
  31. return g
  32. end,
  33. Weld=function(par, p1, cf)
  34. local w=Instance.new("Weld", par) pcall(function() w.Part0=w.Parent or par w.Part1=p1 w.C1=cf or CFrame.new() end)
  35. return w
  36. end,
  37. Mesh=function(ins, par, s, of, t, id)
  38. local m=Instance.new(ins, par) pcall(function() m.Scale=s or Vector3.new() m.Offset=of or Vector3.new() m.MeshId=id or "" m.MeshType=t end)
  39. return m
  40. end,
  41. Sound=function(parent, id, volume, pitch)
  42. local s=Instance.new("Sound", parent) pcall(function() s.SoundId=id s.Volume=volume s.Pitch=pitch end)
  43. return s
  44. end,
  45. }
  46. local scriptname="Pistol" --Name here
  47. pcall(function() char[scriptname]:remove() char["Objects"]:remove() end)
  48. local model=Instance.new("Model", char) model.Name="Objects"
  49. local modelB=Instance.new("Model", char) modelB.Name=scriptname
  50. local skincolor="Really black"
  51. local color="Dark stone grey"
  52. local color2="Black"
  53. local gui
  54. local body={}
  55. local animate={}
  56. local obj={}
  57. --Variables--
  58. local trailDeb=false
  59. local keyDeb=false
  60. local equip=false
  61. local hitDeb=false
  62. local loop=false
  63. local speed=16
  64. local clip=6
  65. local ammo=200
  66. local Gun=add.Sound(torso, "http://www.roblox.com/asset/?id=2691586", .5, 1)
  67. local Reload=add.Sound(torso, "http://www.roblox.com/asset/?id=2760984", .5, 1)
  68. local HeadShot=add.Sound(torso, "http://www.roblox.com/asset/?id=1876552", 1, 1)
  69. local mouse=player:GetMouse()
  70. body.Torso=add.Part(modelB, false, false, skincolor, 1, Vector3.new(2, 2, 1), nil)
  71. body.TorsoW=add.Weld(body.Torso, torso, nil)
  72. --==Pocket==--
  73. obj.Pocket=add.Part(modelB, false, false, color, 0, Vector3.new(.5, .5, 1))
  74. obj.PocketW=add.Weld(obj.Pocket, body.Torso, CFrame.new(1.2, -1.7, 0))
  75. obj.Wedge=add.Wedge(modelB, false, false, color, 0, Vector3.new(.5, .5, 1))
  76. obj.WedgeW=add.Weld(obj.Wedge, obj.Pocket, CFrame.new(0, .5, 0)*CFrame.Angles(0, math.pi, 0))
  77. --==GUN==--
  78. obj.Handle=add.Part(modelB, false,false, color, 0, Vector3.new(.2, .5, .2))
  79. obj.HandleW=add.Weld(obj.Handle, obj.Pocket, CFrame.new(0, .75, 0)*CFrame.Angles(-math.rad(105), 0, 0))
  80. obj.Base=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, 1), nil, Vector3.new(1, .5, 1))
  81. obj.BaseW=add.Weld(obj.Base, obj.Handle, CFrame.new(0, .2, -.1)*CFrame.Angles(math.rad(15), 0, 0))
  82. obj.B2=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, 1), nil, Vector3.new(.8, .35, 1))
  83. obj.B2W=add.Weld(obj.B2, obj.Base, CFrame.new(0, .015, -.2))
  84. obj.W2=add.Wedge(modelB, false, false, color, 0, Vector3.new(.2, .2, .2))
  85. obj.W2W=add.Weld(obj.W2, obj.Base, CFrame.new(0, -.15, .3)*CFrame.Angles(math.pi, 0, 0))
  86. obj.W3=add.Wedge(modelB, false, false, color, 0, Vector3.new(.2, .2, .2), nil, Vector3.new(1, .2, .95))
  87. obj.W3W=add.Weld(obj.W3, obj.Base, CFrame.new(0, -.05, .4)*CFrame.Angles(math.pi, math.pi, 0))
  88. obj.P=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .5, .2))
  89. obj.PM=add.Mesh("CylinderMesh", obj.P, Vector3.new(1, 1, 1))
  90. obj.PW=add.Weld(obj.P, obj.Handle, CFrame.new(0, 0, .1))
  91. obj.P=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .5, .2))
  92. obj.PM=add.Mesh("CylinderMesh", obj.P, Vector3.new(1, 1, 1))
  93. obj.PW=add.Weld(obj.P, obj.Handle, CFrame.new(0, 0, -.1))
  94. obj.B3=add.Part(modelB, false, false, color, 0, Vector3.new(.2, 1.2, .2))
  95. obj.B3M=add.Mesh("CylinderMesh", obj.B3, Vector3.new(.3, 1, .3))
  96. obj.B3W=add.Weld(obj.B3, obj.B2, CFrame.new(0, 0.02, 0)*CFrame.Angles(math.pi/2, 0, 0))
  97. obj.P=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, .2))
  98. obj.PM=add.Mesh("SpecialMesh", obj.P, Vector3.new(.3, .3, .3), nil, "Sphere")
  99. obj.PW=add.Weld(obj.P, obj.B3, CFrame.new(0, -.6, 0))
  100. obj.Barrel=add.Part(modelB, false, false, color, 0, Vector3.new(.2, 1.2, .2))
  101. obj.BarrelM=add.Mesh("CylinderMesh", obj.Barrel, Vector3.new(.5, 1, .5))
  102. obj.BarrelW=add.Weld(obj.Barrel, obj.B2, CFrame.new(0, 0.1, 0)*CFrame.Angles(math.pi/2, 0, 0))
  103. obj.Point=add.Part(modelB, false, false, color2, 0, Vector3.new(.2, .2, .2))
  104. obj.PointM=add.Mesh("CylinderMesh", obj.Point, Vector3.new(.5, .2, .5))
  105. obj.PointW=add.Weld(obj.Point, obj.Barrel, CFrame.new(0, -0.6, 0))
  106.  
  107. obj.Reload=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, 1.3), nil, Vector3.new(1, .8, 1))
  108. obj.ReloadW=add.Weld(obj.Reload, obj.Base, CFrame.new(0, .1, -.15))
  109. obj.P=add.Part(modelB, false, false, color, 0, Vector3.new(.2, 1.3, .2))
  110. obj.PM=add.Mesh("CylinderMesh", obj.P, Vector3.new(.5, 1, .5))
  111. obj.PW=add.Weld(obj.P, obj.Reload, CFrame.new(0, -.07, 0)*CFrame.Angles(math.pi/2, 0, 0))
  112.  
  113. obj.P=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, .4), nil, Vector3.new(.2, .2, .2))
  114. obj.PW=add.Weld(obj.P, obj.Reload, CFrame.new(0, .1, -.52))
  115. obj.W=add.Wedge(modelB, false, false, color, 0, Vector3.new(.2, .2, .4), nil, Vector3.new(.2, .2, .2))
  116. obj.WW=add.Weld(obj.W, obj.Reload, CFrame.new(0, .1, -.6))
  117. obj.P=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, .4), nil, Vector3.new(.2, .2, .2))
  118. obj.PW=add.Weld(obj.P, obj.Reload, CFrame.new(-.05, .1, .5))
  119. obj.W=add.Wedge(modelB, false, false, color, 0, Vector3.new(.2, .2, .4), nil, Vector3.new(.2, .2, .2))
  120. obj.WW=add.Weld(obj.W, obj.P, CFrame.new(0, 0, -.08))
  121. obj.W=add.Wedge(modelB, false, false, color, 0, Vector3.new(.2, .2, .4), nil, Vector3.new(.2, .2, .2))
  122. obj.WW=add.Weld(obj.W, obj.P, CFrame.new(0, 0, .08)*CFrame.Angles(0, math.pi, 0))
  123.  
  124. obj.P=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, .4), nil, Vector3.new(.2, .2, .2))
  125. obj.PW=add.Weld(obj.P, obj.Reload, CFrame.new(.05, .1, .5))
  126. obj.W=add.Wedge(modelB, false, false, color, 0, Vector3.new(.2, .2, .4), nil, Vector3.new(.2, .2, .2))
  127. obj.WW=add.Weld(obj.W, obj.P, CFrame.new(0, 0, -.08))
  128. obj.W=add.Wedge(modelB, false, false, color, 0, Vector3.new(.2, .2, .4), nil, Vector3.new(.2, .2, .2))
  129. obj.WW=add.Weld(obj.W, obj.P, CFrame.new(0, 0, .08)*CFrame.Angles(0, math.pi, 0))
  130.  
  131. obj.C=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .4, .2))
  132. obj.CM=add.Mesh("CylinderMesh", obj.C, Vector3.new(.4, 1, .4))
  133. obj.CW=add.Weld(obj.C, obj.Handle, CFrame.new(0, 0, -.2)*CFrame.Angles(math.rad(105), 0, 0))
  134. obj.C2=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, .2))
  135. obj.C2M=add.Mesh("CylinderMesh", obj.C2, Vector3.new(.4, 1, .4))
  136. obj.C2W=add.Weld(obj.C2, obj.C, CFrame.new(0, -.2, -.09)*CFrame.Angles(-math.rad(105), 0, 0))
  137.  
  138. obj.Trigger=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, .2), nil, Vector3.new(.2, .5, .2))
  139. obj.TriggerW=add.Weld(obj.Trigger, obj.B2, CFrame.new(0, -.1, 0.1)*CFrame.Angles(math.rad(15), 0, 0))
  140. obj.Trigger2=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, .2), nil, Vector3.new(.2, .2, .4))
  141. obj.Trigger2W=add.Weld(obj.Trigger2, obj.Trigger, CFrame.new(0, -.05, -.02)*CFrame.Angles(-math.rad(15), 0, 0))
  142.  
  143. obj.C=add.Part(modelB, false, false, color2, 0, Vector3.new(.2, .2, .2))
  144. obj.CM=add.Mesh("CylinderMesh", obj.C, Vector3.new(.4, 1.1, .4))
  145. obj.CW=add.Weld(obj.C, obj.Handle, CFrame.new(0, .1, -.1)*CFrame.Angles(0, 0, math.pi/2))
  146.  
  147. obj.P=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, 1.2), nil, Vector3.new(.5, .5, 1))
  148. obj.PW=add.Weld(obj.P, obj.Reload, CFrame.new(-.06, 0, 0))
  149.  
  150. obj.P=add.Part(modelB, false, false, color, 0, Vector3.new(.2, .2, 1.2), nil, Vector3.new(.5, .5, 1))
  151. obj.PW=add.Weld(obj.P, obj.Reload, CFrame.new(.06, 0, 0))
  152.  
  153. obj.W=add.Wedge(modelB, false, false, color, 0, Vector3.new(.2, .2, .2), nil, Vector3.new(.5, .35, .4))
  154. obj.WW=add.Weld(obj.W, obj.Reload, CFrame.new(0, .035, .68)*CFrame.Angles(0, math.pi, 0))
  155. obj.W=add.Wedge(modelB, false, false, color, 0, Vector3.new(.2, .2, .2), nil, Vector3.new(.5, .35, .4))
  156. obj.WW=add.Weld(obj.W, obj.Reload, CFrame.new(0, -.035, .68)*CFrame.Angles(math.pi, 0, 0))
  157. function createParts()
  158. torso.Transparency=1
  159. body.Torso.Transparency=0
  160. gui=Instance.new("ScreenGui", player.PlayerGui) gui.Name=scriptname
  161. --==PARTS==--
  162. body.Head=add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil)
  163. body.ArmLeft, body.ArmRight=add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil), add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil)
  164. body.LegLeft, body.LegRight=add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil), add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil)
  165. --==WELDS==--
  166. body.HeadW=add.Weld(body.Head, body.Torso, CFrame.new(0, 1.5, 0))
  167. body.ArmLeftW, body.ArmRightW=add.Weld(body.ArmLeft, body.Torso, CFrame.new(-1.5, .5, 0)), add.Weld(body.ArmRight, body.Torso, CFrame.new(1.5, .5, 0))
  168. body.LegLeftW, body.LegRightW=add.Weld(body.LegLeft, body.Torso, CFrame.new(-.5, -1.5, 0)), add.Weld(body.LegRight, body.Torso, CFrame.new(.5, -1.5, 0))
  169. --==WELDS==--
  170. --add.Weld(body.Head, head, nil)
  171. add.Weld(arm.Left, body.ArmLeft, CFrame.new(0, -.5, 0))
  172. add.Weld(arm.Right, body.ArmRight, CFrame.new(0, -.5, 0))
  173. joints.LeftHip.Part0=body.Torso
  174. joints.RightHip.Part0=body.Torso
  175. ---------------------------------------------------------------------------------------
  176. animate={
  177. ["Head"]=function(cf)
  178. body.HeadW.C1=CFrame.new(0, 1.5, 0)*cf
  179. end;
  180. ["Torso"]=function(cf)
  181. body.TorsoW.C1=cf
  182. end;
  183. ["ArmLeft"]=function(cf)
  184. body.ArmLeftW.C1=CFrame.new(-1.5, .5, 0)*cf
  185. end;
  186. ["ArmRight"]=function(cf)
  187. body.ArmRightW.C1=CFrame.new(1.5, .5, 0)*cf
  188. end;
  189. ["LegLeft"]=function(cf)
  190. legLeftW=add.Weld(leg.Left, body.LegLeft, CFrame.new(0, -.5, 0))
  191. body.LegLeftW.C1=CFrame.new(-.5, -1.5, 0)*cf
  192. c(function()
  193. wait()
  194. legLeftW:remove()
  195. end)
  196. end;
  197. ["LegRight"]=function(cf)
  198. legRightW=add.Weld(leg.Right, body.LegRight, CFrame.new(0, -.5, 0))
  199. body.LegRightW.C1=CFrame.new(.5, -1.5, 0)*cf
  200. c(function()
  201. wait()
  202. legRightW:remove()
  203. end)
  204. end;
  205. }
  206. --==Objects==--
  207. obj.Clip=add.Gui("TextLabel", gui, "Really black", "Really black", "White", "Size18", clip.."/6", 0, UDim2.new(0, 150, 0, 50), UDim2.new(0, 0, 0, 150))
  208. obj.Ammo=add.Gui("TextLabel", obj.Clip, "Really black", "Really black", "White", "Size18", ammo.."/200", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  209. end
  210. function removeParts()
  211. p(function()
  212. body.Torso.Transparency=1
  213. if torso then
  214. joints.LeftShoulder.Part0=torso
  215. joints.RightShoulder.Part0=torso
  216. joints.LeftHip.Part0=torso
  217. joints.RightHip.Part0=torso
  218. end
  219. player.PlayerGui[scriptname]:remove()
  220. for i, v in pairs(model:children()) do v:remove() end
  221. for i, v in pairs(char:children()) do v.Transparency=0 end
  222. torso.Transparency=0
  223. end)
  224. end
  225. function hit(h)
  226. if h.Parent:findFirstChild("Humanoid") and hitDeb==false and h.Parent~=char then
  227. hitDeb=true
  228. local hHuman=h.Parent:findFirstChild("Humanoid")
  229. local hTorso=h.Parent:findFirstChild("Torso")
  230. local dmg=math.random(5, 10)
  231. if h.Name=="Head" then local headshot=HeadShot:clone() headshot.Parent=h headshot:play()
  232. h.Parent:BreakJoints()
  233. local fakeM=Instance.new("Model", workspace) fakeM.Name="HeadShot!"
  234. local fakeH=Instance.new("Humanoid", fakeM) fakeH.MaxHealth=0 fakeH.Health=0
  235. local effect=add.Part(fakeM, true, false, "Bright red", 0, Vector3.new(1, 1, 1), h.CFrame*CFrame.new(0, 4, 0)) effect.Name="Head"
  236. local fakeMesh=add.Mesh("CylinderMesh", effect, Vector3.new(1, .5, 1), nil, nil)
  237. game.Debris:addItem(fakeM, 2)
  238. else
  239. hHuman.Health=hHuman.Health-dmg
  240. local fakeM=Instance.new("Model", workspace) fakeM.Name=-dmg
  241. local fakeH=Instance.new("Humanoid", fakeM) fakeH.MaxHealth=0 fakeH.Health=0
  242. local effect=add.Part(fakeM, true, false, "Bright red", 0, Vector3.new(1, 1, 1), h.CFrame*CFrame.new(0, 4, 0)) effect.Name="Head"
  243. local fakeMesh=add.Mesh("CylinderMesh", effect, Vector3.new(1, .5, 1), nil, nil)
  244. hTorso.RotVelocity=Vector3.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  245. game.Debris:addItem(fakeM, 2)
  246. local effect=add.Part(workspace, true, false, "White", .5, Vector3.new(1, 1, 1), CFrame.new(h.CFrame.p, torso.CFrame.p)*CFrame.Angles(-math.pi/2, 0, 0))
  247. local effectM=add.Mesh("SpecialMesh", effect, Vector3.new(1, 1, 1), nil, nil, "http://www.roblox.com/asset/?id=20329976")
  248. c(function()
  249. for i=1, 2, .2 do wait()
  250. effectM.Scale=Vector3.new(i, i/2, i)
  251. end
  252. effect:remove()
  253. end)
  254. end
  255. wait(.1)
  256. hitDeb=false
  257. end
  258. end
  259. function computePos(pos, pos2)
  260. local pos3=Vector3.new(pos2.x, pos.y, pos2.z)
  261. return CFrame.new(pos, pos3)
  262. end
  263. function trail(pos, cf)
  264. c(function()
  265. local old=(pos.CFrame*cf).p
  266. while trailDeb==true do
  267. wait()
  268. local new=(pos.CFrame*cf).p
  269. local mag=(old-new).magnitude
  270. local dis=(old+new)/2
  271. local trail=add.Part(workspace, true, false, "White", 0, Vector3.new(.5, mag, .5), CFrame.new(dis, new)*CFrame.Angles(math.pi/2, 0, 0)) trail.Name="Trail"
  272. local tMesh=add.Mesh("CylinderMesh", trail, Vector3.new(.5, 1, .5), nil, nil)
  273. old=new
  274. c(function()
  275. for i=1, 0, -.25 do
  276. wait()
  277. tMesh.Scale=tMesh.Scale*Vector3.new(i, 1, i)
  278. end
  279. trail:remove()
  280. end)
  281. c(function()
  282. for i=0, 1, .25 do
  283. wait()
  284. trail.Transparency=i
  285. end
  286. end)
  287. end
  288. end)
  289. end
  290. function reload()
  291. Reload:play()
  292. for i=0, 1, .1 do wait()
  293. animate.Torso(CFrame.Angles(0, math.rad(90-90*i), 0))
  294. animate.ArmLeft(CFrame.new(.5*i, 0, -.5*i)*CFrame.Angles(math.rad(90)*i, 0, math.rad(25)*i))
  295. animate.ArmRight(CFrame.new(-.5*i, 0, -.5*i)*CFrame.Angles(math.rad(90), 0, math.rad(90-135*i)))
  296. end
  297. for i=0, 1, .1 do wait()
  298. obj.ReloadW.C1=CFrame.new(0, .1, -.15+.4*i)
  299. animate.ArmLeft(CFrame.new(.5, 0, -.5)*CFrame.Angles(math.rad(90), 0, math.rad(25+20*i)))
  300. end
  301. c(function()
  302. for i=1, 10 do wait()
  303. local clips=add.Part(workspace, false, true, "Bright yellow", 0,Vector3.new(.2, .2, .4), obj.Handle.CFrame*CFrame.new(0, -.2, 0), Vector3.new(.5, .5, 1))
  304. c(function()
  305. wait(2)
  306. for i=0, 1, .1 do wait()
  307. clips.Transparency=i
  308. end
  309. clips:remove()
  310. end)
  311. end
  312. end)
  313. for i=1, 0, -.1 do wait()
  314. obj.ReloadW.C1=CFrame.new(0, .1, -.15+.4*i)
  315. animate.ArmLeft(CFrame.new(.5, 0, -.5)*CFrame.Angles(math.rad(90), 0, math.rad(25+20*i)))
  316. end
  317. for i=1, 0, -.1 do wait()
  318. animate.Torso(CFrame.Angles(0, math.rad(90-90*i), 0))
  319. animate.ArmLeft(CFrame.new(.5*i, 0, -.5*i)*CFrame.Angles(math.rad(90)*i, 0, math.rad(25)*i))
  320. animate.ArmRight(CFrame.new(-.5*i, 0, -.5*i)*CFrame.Angles(math.rad(90), 0, math.rad(90-135*i)))
  321. end
  322. animate.ArmLeft(CFrame.Angles(-math.rad(15), 0, -math.rad(15)))
  323. if ammo>0 then
  324. local take=6-clip
  325. ammo=ammo-take
  326. clip=clip+take
  327. end
  328. end
  329. mouse.KeyDown:connect(function(key) local key=key:lower()
  330. local bg=Instance.new("BodyGyro") bg.maxTorque=Vector3.new(math.huge, math.huge, math.huge) bg.D=500
  331. if key=="q" and keyDeb==false and equip==false then
  332. keyDeb=true equip=true
  333. mouse.Icon="http://www.roblox.com/asset/?id=35649261"
  334. createParts()
  335. obj.HandleW.Part1=arm.Right
  336. obj.HandleW.C1=CFrame.new(0, -1.2, 0)*CFrame.Angles(-math.rad(105), 0, 0)
  337. for i=0, 1, .1 do wait()
  338. animate.ArmRight(CFrame.new(0, .5*i, 0)*CFrame.Angles(0, 0, -math.rad(10)*i))
  339. end
  340. for i=0, 1, .1 do wait()
  341. animate.Torso(CFrame.Angles(0, math.rad(90)*i, 0))
  342. animate.ArmLeft(CFrame.Angles(-math.rad(15)*i, 0, -math.rad(15)*i))
  343. animate.ArmRight(CFrame.new(0, .5-.5*i, 0)*CFrame.Angles(math.rad(90)*i, 0, math.rad(90)*i))
  344. end
  345. bg.Parent=torso
  346. keyDeb=false
  347. elseif key=="q" and keyDeb==false and equip==true then
  348. keyDeb=true equip=false
  349. mouse.Icon=""
  350. for i=1, 0, -.1 do wait()
  351. animate.ArmRight(CFrame.new(0, .5-.5*i, 0)*CFrame.Angles(math.rad(90)*i, 0, math.rad(90)*i))
  352. end
  353. for i=1, 0, -.1 do wait()
  354. animate.Torso(CFrame.Angles(0, math.rad(90)*i, 0))
  355. animate.ArmLeft(CFrame.Angles(-math.rad(15)*i, 0, -math.rad(15)*i))
  356. animate.ArmRight(CFrame.new(0, .5*i, 0)*CFrame.Angles(0, 0, -math.rad(10)*i))
  357. end
  358. removeParts() for i, v in pairs(torso:children()) do if v:isA("BodyGyro") then v:remove() end end
  359. obj.HandleW.Part1=obj.Pocket
  360. obj.HandleW.C1=CFrame.new(0, .75, 0)*CFrame.Angles(-math.rad(105), 0, 0)
  361. keyDeb=false
  362. end
  363. if key=="r" and keyDeb==false and equip==true then
  364. keyDeb=true
  365. reload()
  366. keyDeb=false
  367. end
  368. while equip==true do wait()
  369. body.HeadW.C1=CFrame.new(Vector3.new(0, 1.5, 0), mouse.Hit.p)
  370. bg.cframe=computePos(torso.CFrame.p, mouse.Hit.p)
  371. obj.Clip.Text=clip.."/6"
  372. obj.Ammo.Text=ammo.."/200"
  373. end
  374. end)
  375. mouse.Button1Down:connect(function()
  376. local speed=500
  377. if equip==true and keyDeb==false and clip>=1 then Gun:play() keyDeb=true
  378. clip=clip-1
  379. animate.ArmRight(CFrame.new(0, 0, 0)*CFrame.Angles(math.rad(90), math.rad(15), math.rad(90)))
  380. local bullet=add.Part(workspace, false, false, "Bright yellow", 0, Vector3.new(.2, 1, .2), CFrame.new(obj.Point.CFrame.p, mouse.Hit.p)*CFrame.Angles(math.pi/2, 0, 0))
  381. local bulletM=add.Mesh("SpecialMesh", bullet, Vector3.new(.04, .05, .04), nil, nil, "http://www.roblox.com/Asset/?id=10207677")
  382. local bf=Instance.new("BodyForce", bullet) bf.force=Vector3.new(0, bullet:GetMass()*196.2, 0)
  383. local effect=add.Part(workspace, true, false, "Bright yellow", .5, Vector3.new(.5, .5, .5), obj.Point.CFrame*CFrame.Angles(math.rad(-45, 45), math.rad(-45, 45), math.rad(-45, 45)))
  384. c(function()
  385. for i=0, 1, .1 do wait()
  386. effect.Transparency=effect.Transparency+(i/2)
  387. effect.Mesh.Scale=effect.Mesh.Scale+Vector3.new(i, i, i)
  388. end
  389. effect:remove()
  390. end)
  391. trailDeb=true
  392. trail(bullet, CFrame.new())
  393. bullet.Touched:connect(hit)
  394. bullet.Velocity=CFrame.new((obj.Point.CFrame*CFrame.Angles(math.pi/2, 0, 0)).p, mouse.Hit.p).lookVector*speed
  395. c(function() wait(1.5) bullet:destroy() trailDeb=false end)
  396. wait(.5)
  397. animate.ArmRight(CFrame.new(0, 0, 0)*CFrame.Angles(math.rad(90), 0, math.rad(90)))
  398. keyDeb=false
  399. elseif equip==true and keyDeb==false then
  400. keyDeb=true
  401. reload()
  402. keyDeb=false
  403. end
  404. end)--mediafire
Add Comment
Please, Sign In to add comment