Advertisement
ohhhhhhshdhashdahsd

nmoom1 gun

Jul 1st, 2015
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.14 KB | None | 0 0
  1. wait(0.001);
  2.  
  3. --------------------------------------------------------------------------------------
  4.  
  5. _clear=function()
  6. local c={char;bag;gui;};
  7. for i=1,#c do
  8. local c=c[i]:children();
  9. for i=1,#c do
  10. if(c[i].Name==name)then
  11. c[i].Parent=nil;
  12. end;
  13. end;
  14. end;
  15. local n=name..user.Name;
  16. local c=workspace:children();
  17. for i=1,#c do
  18. if(c[i].Name==n)then
  19. c[i].Parent=nil;
  20. end;
  21. end;
  22. end;
  23.  
  24. _valid_key=function(object,key)
  25. return object[key],key;
  26. end;
  27.  
  28. _new=function(class)
  29. return function(props)
  30. if(type(list_base_props)=='table')then
  31. for i,v in next,list_base_props do
  32. if(props[i]==nil)then
  33. props[i]=v;
  34. end;
  35. end;
  36. end;
  37.  
  38. local object=class;
  39.  
  40. if(type(class)=='string')then
  41. object=Instance.new(class:sub(1,1):upper()..class:sub(2));
  42. end;
  43.  
  44. local parent=props[1];
  45. props[1]=nil;
  46.  
  47. for i,v in next,props do
  48. local load,res,key=pcall(_valid_key,object,i:sub(1,1):upper()..i:sub(2));
  49. if(not load)then
  50. load,res,key=pcall(_valid_key,object,i);
  51. end;
  52.  
  53. if(key)then
  54. t=type(res);
  55. s=tostring(res);
  56. if(t=='userdata'and s=='Signal '..key)then
  57. if(type(v)=='table')then
  58. for i=1,#v do
  59. res:connect(v[i]);
  60. end;
  61. else
  62. res:connect(v);
  63. end;
  64. else
  65. object[key]=v;
  66. end;
  67. end;
  68. end;
  69.  
  70. if(parent)then
  71. object.Parent=parent;
  72. end;
  73.  
  74. return object;
  75. end;
  76. end;
  77.  
  78. _RGB=function(r,g,b)
  79. return Color3.new(r/255,g/255,b/255);
  80. end;
  81.  
  82. _copy=function(o)
  83. local def=o.archivable;
  84. o.archivable=true;
  85. local c=o:clone();
  86. o.archivable=def;
  87. return c;
  88. end;
  89.  
  90. _hum=function(char)
  91. local hum=char:findFirstChild'Humanoid';
  92. if(not hum or hum.className~='Humanoid')then
  93. local c=char:children();
  94. for i=1,#c do
  95. if(c[i].className=='Humanoid')then
  96. return c[i];
  97. end;
  98. end;
  99. else
  100. return hum;
  101. end;
  102. end;
  103.  
  104. _hum_tag=function(hum)
  105. local c=hum:findFirstChild'creator'or Instance.new('ObjectValue',hum);
  106. c.Name='creator';
  107. c.Value=user;
  108. if(hum.Health==0 and not hum:findFirstChild'killed')then
  109. Instance.new('BoolValue',hum).Name='killed';
  110. bullets.clip=bullets.clip+10;
  111. end;
  112. end;
  113.  
  114. _hum_dam=function(hum,dam,percent)
  115. hum.Health=hum.Health-(percent and hum.MaxHealth*(dam*0.01)or dam);
  116. if(hum.Health<=hum.MaxHealth*0.1)then
  117. _hum_tag(hum);
  118. end;
  119. end;
  120.  
  121. _ray=function(v0,v1,i)
  122. local mag=(v0-v1).magnitude;
  123. local ray=Ray.new(v0,(v1-v0).unit*(mag>999 and 999 or mag));
  124.  
  125. return(type(i)=='table'and workspace.FindPartOnRayWithIgnoreList or workspace.FindPartOnRay)(workspace,ray,i);
  126. end;
  127.  
  128. _must=function(v0,v1,i)
  129. local hit,pos=_ray(v0,v1,i);
  130. return not hit and mouse.target or hit,pos;
  131. end;
  132.  
  133. _cframe=function(x,y,z,r0,r1,r2)
  134. return CFrame.Angles(
  135. math.rad(r0 or 0),
  136. math.rad(r1 or 0),
  137. math.rad(r2 or 0)
  138. )*CFrame.new(x,y,z);
  139. end;
  140.  
  141. _update=function()
  142. if(bool_active and not screen.Parent)then
  143. screen.Parent=gui;
  144. elseif(not bool_active and screen.Parent)then
  145. screen.Parent=nil;
  146. end;
  147. end;
  148.  
  149. _light=function(v0,v1)
  150. local mag=(v0-v1).magnitude;
  151. local len=math.random(2,7);
  152. len=len>mag/2 and mag/2 or len;
  153.  
  154. local light=_new'part'{
  155. cFrame=CFrame.new(v0,v1);
  156. size=Vector3.new(1,1,1);
  157. color=_RGB(255,255,0);
  158. anchored=true;
  159. inv;
  160. };
  161. _new'blockMesh'{
  162. scale=Vector3.new(0.2,0.2,len);
  163. offset=Vector3.new(0,0,-len/2);
  164. light;
  165. };
  166.  
  167. local bb=_new'billboardGui'{
  168. size=UDim2.new(2,0,2,0);
  169. adornee=light;
  170. light;
  171. };
  172. _new'imageLabel'{
  173. image=url:format(109101526);
  174. backgroundTransparency=1;
  175. size=UDim2.new(1,0,1,0);
  176. bb;
  177. };
  178.  
  179. _rem(light,0.15);
  180. end;
  181.  
  182. _rem=function(object,del)
  183. if(del)then
  184. delay(del,function()
  185. if(object.Parent)then
  186. object.Parent=nil;
  187. end;
  188. end);
  189. else
  190. pcall(function()
  191. if(object.Parent)then
  192. object.Parent=nil;
  193. end;
  194. end);
  195. end;
  196. end;
  197.  
  198. _blood=function(pos,count)
  199. for i=1,count do
  200. local p=_new'part'{
  201. rotVelocity=Vector3.new(math.random(),math.random(),math.random())*50;
  202. position=pos+Vector3.new(math.random(),math.random(),math.random());
  203. velocity=Vector3.new(math.random(),math.random(),math.random())*50;
  204. size=Vector3.new(math.random(),math.random(),math.random())/3;
  205. color=_RGB(255,0,0);
  206. transparency=0.5;
  207. canCollide=true;
  208. bottomSurface=0;
  209. topSurface=0;
  210. formFactor=3;
  211. locked=true;
  212. inv;
  213. };
  214. delay(5,function()
  215. p.Parent=nil;
  216. end);
  217. end;
  218. end;
  219.  
  220. _make_hue=function()
  221. h_hue=_new'part'{
  222. size=Vector3.new(0.25,1.8,0.35);
  223. color=_RGB(100,100,100);
  224. formFactor=3;
  225. name='hue';
  226. handle;
  227. };
  228. hh_weld=_new'weld'{
  229. c1=_cframe(0,0.5,0);
  230. part0=handle;
  231. part1=h_hue;
  232. handle;
  233. };
  234. end;
  235.  
  236. _shot=function(v0,v1)
  237. if(not time_left)then
  238. time_left=0;
  239. end;
  240. if(time_left>time())then
  241. return nil;
  242. else
  243. time_left=time()+math.random(1,10)/100;
  244. end;
  245.  
  246. if(bullets.current<1)then
  247. local tick_sound=head:findFirstChild'tick_sound'or _new'sound'{
  248. soundId='rbxasset://sounds/SWITCH3.wav';
  249. name='tick_sound';
  250. volume=0.2;
  251. pitch=2;
  252. head;
  253. };
  254. tick_sound:play();
  255. if(bullets.clip>0)then
  256. time_left=time()+2;
  257. h_hue:breakJoints();
  258. h_hue.CanCollide=true;
  259. h_hue.Velocity=(h_hue.CFrame*CFrame.new(0,5,0)).lookVector*10;
  260. _rem(h_hue,10);
  261. delay(1.9,function()
  262. _make_hue();
  263. local got=(bullets.clip>bullets.maximum and
  264. bullets.maximum or
  265. bullets.clip)-bullets.current;
  266.  
  267. bullets.clip=bullets.clip-got;
  268. bullets.current=bullets.current+got;
  269. end);
  270. end;
  271. return nil;
  272. else
  273. bullets.current=bullets.current-1;
  274.  
  275. h_weld.C1=_cframe(0,0.75,0,
  276. -math.random(1000,1100)/10,180,0);
  277. d_weld.C1=_cframe(0,-0.25,0.3);
  278.  
  279. lightstuff.Visible=true;
  280. delay(0.1,function()
  281. lightstuff.Visible=false;
  282. end);
  283.  
  284. _rem(_new'part'{
  285. velocity=CFrame.new(drag.Position,(drag.CFrame*CFrame.new(-4,-5,0)).p).lookVector*10;
  286. cFrame=drag.CFrame*CFrame.new(-0.5,0,0);
  287. size=Vector3.new(0.1,0.1,0.4);
  288. color=_RGB(200,200,0);
  289. material='Slate';
  290. canCollide=true;
  291. formFactor=3;
  292. inv;
  293. },5);
  294. delay(0.1,function()
  295. d_weld.C1=_cframe(0,-0.25,0);
  296. if(bool_active)then
  297. h_weld.C1=h_weld_cf_active;
  298. end;
  299. end)
  300. end;
  301.  
  302. local hit,pos=_must(v0,v1,char);
  303.  
  304. shot_sound:play();
  305.  
  306. _light(v0,v1);
  307.  
  308. if(not hit)then return nil;end;
  309.  
  310. if(hit.Parent.className=='Hat')then
  311. hit:breakJoints();
  312. hit.CanCollide=true;
  313. hit.Velocity=CFrame.new(v0,pos).lookVector*math.random(30,50);
  314. hit.RotVelocity=Vector3.new(math.random(1,90),math.random(1,90),math.random(1,90));
  315. else
  316. local hum=_hum(hit.Parent);
  317. if(not hum)then
  318. if(hit.Anchored==false and hit.Size.magnitude<4)then
  319. hit:breakJoints();
  320. hit.CanCollide=true;
  321. end;
  322. else
  323. _hum_dam(hum,math.random(4,6));
  324. _blood(pos,math.random(3,6));
  325. hit.RotVelocity=Vector3.new(math.random(1,90),math.random(1,90),math.random(1,90))/6;
  326. if(hit.Name=='Head')then
  327. hum.Health=0;
  328. _blood(pos,math.random(3,6));
  329. delay(0.001,function()
  330. _new(workspace:FindFirstChild'head_shot'or'sound'){
  331. pitch=math.random(70,100)*0.01;
  332. soundId=url:format(1876552);
  333. name='head_shot';
  334. workspace;
  335. }:play();
  336. end);
  337. _hum_tag(hum);
  338. _rem(_new'part'{
  339. cFrame=CFrame.new(v0,pos)*CFrame.new(0,0,-(v0-pos).magnitude*0.5);
  340. size=Vector3.new(0.1,0.1,(v0-pos).magnitude);
  341. color=torso.Color;
  342. transparency=0.5;
  343. canCollide=false;
  344. bottomSurface=0;
  345. anchored=true;
  346. formFactor=3;
  347. topSurface=0;
  348. inv;
  349. },30);
  350. hit.Parent=nil;
  351. for b=0,1 do
  352. for a=0,1 do
  353. for i=0,1 do
  354. _rem(_new'part'{
  355. velocity=CFrame.new(v0,pos).lookVector*20;
  356. cFrame=hit.CFrame*CFrame.new(i,-b,a);
  357. size=Vector3.new(0.5,0.5,0.5);
  358. color=_RGB(255,255,255);
  359. bottomSurface=0;
  360. canCollide=true;
  361. transparency=0;
  362. formFactor=3;
  363. topSurface=0;
  364. hum;
  365. },30);
  366. end;
  367. end;
  368. end;
  369. end;
  370. end;
  371. end;
  372. end;
  373.  
  374. ----------------------------------------------------------------------------------------
  375.  
  376. _cf_select=function(mouse)
  377. mouse.Icon=url:format(109111387);--108999296
  378. bool_active=true;
  379.  
  380. local arm=char:findFirstChild'Right Arm';
  381. local weld=torso:findFirstChild'Right Shoulder';
  382. if(arm and weld)then
  383. h_weld.Part0=arm;
  384. h_weld.C1=h_weld_cf_active;
  385.  
  386. weld.Part1=nil;
  387. weld.Part0=nil;
  388.  
  389. weld=_new(torso:findFirstChild'right_arml'or'weld'){
  390. name='right_arml';
  391. part0=torso;
  392. part1=arm;
  393. torso;
  394. };
  395.  
  396. arml=(arml or 0)+1;
  397. local alv=arml;
  398. local gyro=torso:findFirstChild'p_gyro'or Instance.new('BodyGyro',torso);
  399. gyro.maxTorque=Vector3.new(5e5,5e5,5e5);
  400. gyro.P=30000;
  401. gyro.D=1000;
  402. gyro.Name='p_gyro';
  403. repeat
  404. local pos=mouse.hit.p;
  405. local val,valp,p0,p1,p2,hitpos,cj,c0,c1;
  406.  
  407. val=-math.pi*0.5;
  408. valp=val*-1;
  409. p0=torso.CFrame;
  410. p0=p0+((p0*CFrame.Angles(valp,0,0)).lookVector*0.5)+(p0*CFrame.Angles(0,val,0)).lookVector;
  411. p1=p0+((p0.p-pos).unit*-2);
  412. p2=CFrame.new((p0.p+p1.p)/2,p0.p)*CFrame.Angles(val,val,0);
  413. hitpos=torso.Position;
  414. cj=CFrame.new(hitpos);
  415. c0=torso.CFrame:inverse()*cj;
  416. c1=p2:inverse()*cj;
  417. weld.C0=c0;
  418. weld.C1=c1;
  419.  
  420. gyro.cframe=CFrame.new(torso.Position,Vector3.new(pos.X,torso.Position.Y,pos.Z));
  421.  
  422. wait(0.001);
  423. until arml~=alv;
  424. gyro.Parent=nil;
  425. end;
  426. end;
  427.  
  428. _cf_deselect=function()
  429. bool_active=false;
  430. arml=(arml or 0)+1;
  431. loop_shot=(loop_shot or 0)+1;
  432.  
  433. h_weld.Part0=torso;
  434. h_weld.C1=h_weld_cf_inactive;
  435.  
  436. local weld=torso:findFirstChild'right_arml';
  437. if(weld)then
  438. weld.Part1=nil;
  439. weld.Part0=nil;
  440. end;
  441. local arm=char:findFirstChild'Right Arm';
  442. local weld=torso:findFirstChild'Right Shoulder';
  443. if(arm and weld)then
  444. weld.Part0=torso;
  445. weld.Part1=arm;
  446. end;
  447. end;
  448.  
  449. _cf_mouse=function(event,fun)
  450. mouse[event:sub(1,1):upper()..event:sub(2)]:connect(function(...)
  451. if(bool_active)then
  452. fun(...);
  453. end;
  454. end);
  455. end;
  456.  
  457. ----------------------------------------------------------------------------------------
  458.  
  459. do
  460. local main=getfenv(0);
  461. local c=game:children();
  462. local check=function(v)
  463. if(v.className~=''and v.className~='Instance'and game:service(v.className))then
  464. main[v.className:sub(1,1):lower()..v.className:sub(2)]=v;
  465. end;
  466. end;
  467. for i=1,#c do
  468. pcall(check,c[i]);
  469. end;
  470. end;
  471.  
  472. ----------------------------------------------------------------------------------------
  473.  
  474. bullets={
  475. maximum=51111111111111111111111111110;
  476. current=511111111111111111111111111111110;
  477. clip=501111111111111111111111111111111*4;
  478. };
  479.  
  480. list_base_props={
  481. backgroundColor3=_RGB(0,0,0);
  482. textColor3=_RGB(200,200,200);
  483. borderSizePixel=0;
  484. color=_RGB(0,0,0);
  485. archivable=false;
  486. canCollide=false;
  487. bottomSurface=0;
  488. topSurface=0;
  489. formFactor=0;
  490. locked=true;
  491. };
  492.  
  493. ----------------------------------------------------------------------------------------
  494.  
  495. user=players.localPlayer;
  496. mouse=user:getMouse();
  497. char=user.Character;
  498. gui=user.PlayerGui;
  499. bag=user.Backpack;
  500. torso=char.Torso;
  501. head=char.Head;
  502. hum=_hum(char);
  503.  
  504. url='rbxassetid://%d';
  505. name='dev-uzi';
  506.  
  507. h_weld_cf_inactive=_cframe(0.35,0.5,0.5,
  508. 0,90,-70);
  509. h_weld_cf_active=_cframe(0,0.75,0,
  510. -110,180,0);
  511.  
  512. assert(hum,'humanoid is not found');
  513.  
  514. ----------------------------------------------------------------------------------------
  515.  
  516. _clear();
  517.  
  518. ----------------------------------------------------------------------------------------
  519.  
  520. _cf_mouse('button1Down',function()
  521. loop_shot=(loop_shot or 0)+1;
  522. local vers=loop_shot;
  523. local step=runService.Stepped;
  524. repeat
  525. _shot((tube.CFrame*CFrame.new(0,0,tube.Size.Z*0.5)).p,mouse.hit.p);
  526. step:wait();--wait(0.001);
  527. until vers~=loop_shot;
  528. end);
  529.  
  530. _cf_mouse('button1Up',function()
  531. loop_shot=(loop_shot or 0)+1;
  532. end);
  533.  
  534. _cf_mouse('move',function()
  535. cross_f.Position=UDim2.new(0,mouse.X-11,0,mouse.Y-11);
  536. end);
  537.  
  538. _cf_mouse('keyDown',function(k)
  539. if(k=='r')then
  540. if(bullets.clip>0 and time_left<=time())then
  541. local got=(bullets.clip>bullets.maximum and
  542. bullets.maximum or
  543. bullets.clip)-bullets.current;
  544.  
  545. bullets.clip=bullets.clip-got;
  546. bullets.current=bullets.current+got;
  547. if(got~=0)then
  548. time_left=time()+2;
  549. end;
  550. end;
  551. end;
  552. end);
  553.  
  554. ----------------------------------------------------------------------------------------
  555.  
  556. screen=_new'screenGui'{
  557. name=name;
  558. };
  559.  
  560. cross_f=_new'frame'{
  561. size=UDim2.new(0,21,0,21);
  562. backgroundTransparency=1;
  563. screen;
  564. };
  565.  
  566. for i=0,1 do
  567. _new'frame'{
  568. position=UDim2.new(0,13*i,0,11);
  569. size=UDim2.new(0,10,0,1);
  570. cross_f;
  571. };
  572. end;
  573.  
  574. for i=0,1 do
  575. _new'frame'{
  576. position=UDim2.new(0,11,0,13*i);
  577. size=UDim2.new(0,1,0,10);
  578. cross_f;
  579. };
  580. end;
  581.  
  582. ----------------------------------------------------------------------------------------
  583.  
  584. shot_sound=_new(head:findFirstChild'2920959'or'sound'){
  585. soundId=url:format(2920959);
  586. pitch=1.4;
  587. head;
  588. };
  589. if(shot_sound.Name~='2920959')then
  590. shot_sound.Name='2920959';
  591. shot_sound:play();
  592. end;
  593.  
  594. bin=_new'hopperBin'{
  595. deselected=_cf_deselect;
  596. selected=_cf_select;
  597. name=name;
  598. bag;
  599. };
  600.  
  601. inv=_new'model'{
  602. name=name;
  603. char;
  604. };
  605.  
  606. handle=_new'part'{
  607. size=Vector3.new(0.3,1.3,0.4);
  608. color=_RGB(140,140,140);
  609. name='handle';
  610. formFactor=3;
  611. inv;
  612. touched=function(hit)
  613. if(hit.Parent.className=='Model')then
  614. local hum=_hum(hit.Parent);
  615. if(hum~=nil)then
  616. _hum_dam(hum,handle.Velocity.magnitude);
  617. end;
  618. end;
  619. end;
  620. };
  621. h_weld=_new'weld'{
  622. c1=h_weld_cf_inactive;
  623. part1=handle;
  624. part0=torso;
  625. handle;
  626. };
  627. _make_hue();
  628.  
  629. h_part=_new'part'{
  630. size=Vector3.new(0.4,0.4,1.4);
  631. color=_RGB(140,140,140);
  632. name='handle';
  633. formFactor=3;
  634. handle;
  635. };
  636. hp_weld=_new'weld'{
  637. c1=_cframe(0,-1.3/2,-0.3,
  638. 20,0,0);
  639. part0=handle;
  640. part1=h_part;
  641. handle;
  642. };
  643.  
  644. drag=_new'part'{
  645. size=Vector3.new(0.5,0.45,1.5);
  646. color=_RGB(100,100,100);
  647. name='handle';
  648. formFactor=3;
  649. handle;
  650. };
  651. d_weld=_new'weld'{
  652. c1=_cframe(0,-0.25,0);
  653. part0=h_part;
  654. part1=drag;
  655. handle;
  656. };
  657.  
  658. tube=_new'part'{
  659. size=Vector3.new(0.2,0.2,1.5);
  660. color=_RGB(0,0,0);
  661. name='handle';
  662. formFactor=3;
  663. handle;
  664. };
  665. t_weld=_new'weld'{
  666. c1=_cframe(0,-0.3,-0.1);
  667. part0=h_part;
  668. part1=tube;
  669. handle;
  670. };
  671.  
  672. bullets_label=_new'textLabel'{
  673. textStrokeColor3=_RGB(0,0,0);
  674. textColor3=_RGB(200,200,200);
  675. textStrokeTransparency=0;
  676. backgroundTransparency=1;
  677. fontSize=5;
  678. screen;
  679. };
  680.  
  681. lightstuff=_new'frame'{
  682. backgroundColor3=_RGB(255,255,255);
  683. position=UDim2.new(0,0,0,-1);
  684. backgroundTransparency=0.5;
  685. size=UDim2.new(1,0,1,1);
  686. borderSizePixel=0;
  687. visible=false;
  688. screen;
  689. };
  690.  
  691. coroutine.wrap(function()
  692. local red,white,green;
  693. repeat
  694. if(screen.Parent)then
  695. if(not green and bullets.current==bullets.maximum)then
  696. green=true;
  697. bullets_label.TextColor3=_RGB(0,200,0);
  698. elseif(not red and bullets.current==0)then
  699. red=true;
  700. bullets_label.TextColor3=_RGB(200,0,0);
  701. elseif((red or green)and bullets.current~=0 and bullets.current~=bullets.maximum)then
  702. bullets_label.TextColor3=_RGB(200,200,200);
  703. green=false;
  704. red=false;
  705. end;
  706. bullets_label.Text=('Bullets: %d/%d'):format(bullets.current,bullets.clip);
  707. bullets_label.Size=UDim2.new(0,bullets_label.TextBounds.X,0,bullets_label.TextBounds.Y);
  708. bullets_label.Position=UDim2.new(1,-bullets_label.TextBounds.X-6,1,-bullets_label.TextBounds.Y-6);
  709. end;
  710. wait(0.001);
  711. until nil;
  712. end)();
  713.  
  714. ----------------------------------------------------------------------------------------
  715.  
  716. _G.dev_pistol_version=(_G.dev_pistol_version or 0)+1;
  717. local vers=_G.dev_pistol_version;
  718. repeat _update();wait(0.001);until _G.dev_pistol_version~=vers or hum.Health==0;
  719. if(hum.Health==0)then
  720. _clear();
  721. end;
  722. script.Disabled=true;
  723.  
  724. --mediafire-----------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement