Advertisement
rektv25

Untitled

Mar 29th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.47 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152. print("IM TRYING")
  153. wait(0.25);
  154.  
  155.  
  156. _clear=function()
  157. local c={char;bag;gui;};
  158. for i=1,#c do
  159. local c=c[i]:children();
  160. for i=1,#c do
  161. if(c[i].Name==name)then
  162. c[i].Parent=nil;
  163. end;
  164. end;
  165. end;
  166. local n=name..user.Name;
  167. local c=workspace:children();
  168. for i=1,#c do
  169. if(c[i].Name==n)then
  170. c[i].Parent=nil;
  171. end;
  172. end;
  173. end;
  174.  
  175. _valid_key=function(object,key)
  176. return object[key],key;
  177. end;
  178.  
  179. _new=function(class)
  180. return function(props)
  181. if(type(list_base_props)=='table')then
  182. for i,v in next,list_base_props do
  183. if(props[i]==nil)then
  184. props[i]=v;
  185. end;
  186. end;
  187. end;
  188.  
  189. local object=class;
  190.  
  191. if(type(class)=='string')then
  192. object=Instance.new(class:sub(1,1):upper()..class:sub(2));
  193. end;
  194.  
  195. local parent=props[1];
  196. props[1]=nil;
  197.  
  198. for i,v in next,props do
  199. local load,res,key=pcall(_valid_key,object,i:sub(1,1):upper()..i:sub(2));
  200. if(not load)then
  201. load,res,key=pcall(_valid_key,object,i);
  202. end;
  203.  
  204. if(key)then
  205. t=type(res);
  206. s=tostring(res);
  207. if(t=='userdata'and s=='Signal '..key)then
  208. if(type(v)=='table')then
  209. for i=1,#v do
  210. res:connect(v[i]);
  211. end;
  212. else
  213. res:connect(v);
  214. end;
  215. else
  216. object[key]=v;
  217. end;
  218. end;
  219. end;
  220.  
  221. if(parent)then
  222. object.Parent=parent;
  223. end;
  224.  
  225. return object;
  226. end;
  227. end;
  228.  
  229. _RGB=function(r,g,b)
  230. return Color3.new(r/255,g/255,b/255);
  231. end;
  232.  
  233. _copy=function(o)
  234. local def=o.archivable;
  235. o.archivable=true;
  236. local c=o:clone();
  237. o.archivable=def;
  238. return c;
  239. end;
  240.  
  241. _hum=function(char)
  242. local hum=char:findFirstChild'Humanoid';
  243. if(not hum or hum.className~='Humanoid')then
  244. local c=char:children();
  245. for i=1,#c do
  246. if(c[i].className=='Humanoid')then
  247. return c[i];
  248. end;
  249. end;
  250. else
  251. return hum;
  252. end;
  253. end;
  254.  
  255. _hum_tag=function(hum)
  256. local c=hum:findFirstChild'creator'or Instance.new('ObjectValue',hum);
  257. c.Name='creator';
  258. c.Value=user;
  259. if(hum.Health==0 and not hum:findFirstChild'killed')then
  260. Instance.new('BoolValue',hum).Name='killed';
  261. bullets.clip=bullets.clip+10;
  262. end;
  263. end;
  264.  
  265. _hum_dam=function(hum,dam,percent)
  266. hum.Health=hum.Health-(percent and hum.MaxHealth*(dam*0.01)or dam);
  267. if(hum.Health<=hum.MaxHealth*0.1)then
  268. _hum_tag(hum);
  269. end;
  270. end;
  271.  
  272. _ray=function(v0,v1,i)
  273. local mag=(v0-v1).magnitude;
  274. local ray=Ray.new(v0,(v1-v0).unit*(mag>999 and 999 or mag));
  275.  
  276. return(type(i)=='table'and workspace.FindPartOnRayWithIgnoreList or workspace.FindPartOnRay)(workspace,ray,i);
  277. end;
  278.  
  279. _must=function(v0,v1,i)
  280. local hit,pos=_ray(v0,v1,i);
  281. return not hit and mouse.target or hit,pos;
  282. end;
  283.  
  284. _cframe=function(x,y,z,r0,r1,r2)
  285. return CFrame.Angles(
  286. math.rad(r0 or 0),
  287. math.rad(r1 or 0),
  288. math.rad(r2 or 0)
  289. )*CFrame.new(x,y,z);
  290. end;
  291.  
  292. _update=function()
  293. if(bool_active and not screen.Parent)then
  294. screen.Parent=gui;
  295. elseif(not bool_active and screen.Parent)then
  296. screen.Parent=nil;
  297. end;
  298. end;
  299.  
  300. _light=function(v0,v1)
  301. local mag=(v0-v1).magnitude;
  302. local len=math.random(2,7);
  303. len=len>mag/2 and mag/2 or len;
  304.  
  305. --local light=_new'part'{
  306. -- cFrame=CFrame.new(v0,v1);
  307. -- size=Vector3.new(1,1,1);
  308. -- color=_RGB(255,255,0);
  309. -- anchored=true;
  310. -- inv;
  311. --};
  312. _new'blockMesh'{
  313. scale=Vector3.new(0.2,0.2,len);
  314. offset=Vector3.new(0,0,-len/2);
  315. light;
  316. };
  317.  
  318. local bb=_new'billboardGui'{
  319. size=UDim2.new(2,0,2,0);
  320. adornee=light;
  321. light;
  322. };
  323. _new'imageLabel'{
  324. image=url:format(109101526);
  325. backgroundTransparency=1;
  326. size=UDim2.new(1,0,1,0);
  327. bb;
  328. };
  329.  
  330. -- _rem(light,0.15);
  331. end;
  332.  
  333. _rem=function(object,del)
  334. if(del)then
  335. delay(del,function()
  336. if(object.Parent)then
  337. object.Parent=nil;
  338. end;
  339. end);
  340. else
  341. pcall(function()
  342. if(object.Parent)then
  343. object.Parent=nil;
  344. end;
  345. end);
  346. end;
  347. end;
  348.  
  349. _blood=function(pos,count)
  350. for i=1,count do
  351. local p=_new'part'{
  352. rotVelocity=Vector3.new(math.random(),math.random(),math.random())*50;
  353. position=pos+Vector3.new(math.random(),math.random(),math.random());
  354. velocity=Vector3.new(math.random(),math.random(),math.random())*50;
  355. size=Vector3.new(math.random(),math.random(),math.random())/3;
  356. color=_RGB(255,0,0);
  357. transparency=0.5;
  358. canCollide=true;
  359. bottomSurface=0;
  360. topSurface=0;
  361. formFactor=3;
  362. locked=true;
  363. inv;
  364. };
  365. delay(5,function()
  366. p.Parent=nil;
  367. end);
  368. end;
  369. end;
  370.  
  371. _make_hue=function()
  372. h_hue=_new'part'{
  373. size=Vector3.new(0.25,1.8,0.35);
  374. color=_RGB(100,100,100);
  375. formFactor=3;
  376. name='hue';
  377. handle;
  378. };
  379. hh_weld=_new'weld'{
  380. c1=_cframe(0,0.5,0);
  381. part0=handle;
  382. part1=h_hue;
  383. handle;
  384. };
  385. end;
  386.  
  387. _shot=function(v0,v1)
  388. if(not time_left)then
  389. time_left=0;
  390. end;
  391. if(time_left>time())then
  392. return nil;
  393. else
  394. time_left=time()+math.random(1,10)/100;
  395. end;
  396.  
  397. if(bullets.current<1)then
  398. local tick_sound=head:findFirstChild'tick_sound'or _new'sound'{
  399. soundId='rbxasset://sounds/SWITCH3.wav';
  400. name='tick_sound';
  401. volume=0.2;
  402. pitch=2;
  403. head;
  404. };
  405. tick_sound:play();
  406. if(bullets.clip>0)then
  407. time_left=time()+2;
  408. h_hue:breakJoints();
  409. h_hue.CanCollide=true;
  410. h_hue.Velocity=(h_hue.CFrame*CFrame.new(0,5,0)).lookVector*10;
  411. _rem(h_hue,10);
  412. delay(1.9,function()
  413. _make_hue();
  414. local got=(bullets.clip>bullets.maximum and
  415. bullets.maximum or
  416. bullets.clip)-bullets.current;
  417.  
  418. bullets.clip=bullets.clip-got;
  419. bullets.current=bullets.current+got;
  420. end);
  421. end;
  422. return nil;
  423. else
  424. bullets.current=bullets.current-1;
  425.  
  426. h_weld.C1=_cframe(0,0.75,0,
  427. -math.random(1000,1100)/10,180,0);
  428. d_weld.C1=_cframe(0,-0.25,0.3);
  429.  
  430. lightstuff.Visible=true;
  431. delay(0.1,function()
  432. lightstuff.Visible=false;
  433. end);
  434.  
  435. _rem(_new'part'{
  436. velocity=CFrame.new(drag.Position,(drag.CFrame*CFrame.new(-4,-5,0)).p).lookVector*10;
  437. cFrame=drag.CFrame*CFrame.new(-0.5,0,0);
  438. size=Vector3.new(0.1,0.1,0.4);
  439. color=_RGB(200,200,0);
  440. material='Slate';
  441. canCollide=true;
  442. formFactor=3;
  443. inv;
  444. },5);
  445.  
  446. delay(0.1,function()
  447. d_weld.C1=_cframe(0,-0.25,0);
  448. if(bool_active)then
  449. h_weld.C1=h_weld_cf_active;
  450. end;
  451. end)
  452. end;
  453.  
  454. local hit,pos=_must(v0,v1,char);
  455.  
  456. shot_sound:play();
  457.  
  458.  
  459. _rem(_new'part'{
  460. cFrame=CFrame.new(v0,pos)*CFrame.new(0,0,-(v0-pos).magnitude*0.5);
  461. size=Vector3.new(0.1,0.1,(v0-pos).magnitude);
  462. color=_RGB(255,255,0);
  463. transparency=0.6;
  464. reflectance=0.5;
  465. canCollide=false;
  466. bottomSurface=0;
  467. anchored=true;
  468. formFactor=3;
  469. topSurface=0;
  470. inv;
  471. },.15);
  472. _light(v0,v1);
  473.  
  474. if(not hit)then return nil;end;
  475.  
  476. if(hit.Parent.className=='Hat')then
  477. hit:breakJoints();
  478. hit.CanCollide=true;
  479. hit.Velocity=CFrame.new(v0,pos).lookVector*math.random(30,50);
  480. hit.RotVelocity=Vector3.new(math.random(1,90),math.random(1,90),math.random(1,90));
  481. else
  482. local hum=_hum(hit.Parent);
  483. if(not hum)then
  484. if(hit.Anchored==false and hit.Size.magnitude<4)then
  485. hit:breakJoints();
  486. hit.CanCollide=true;
  487. end;
  488. else
  489. _hum_dam(hum,math.random(4,6));
  490. _blood(pos,math.random(3,6));
  491. hit.RotVelocity=Vector3.new(math.random(1,90),math.random(1,90),math.random(1,90))/6;
  492. if(hit.Name=='Head')then
  493. hum.Health=0;
  494. _blood(pos,math.random(3,6));
  495. delay(0.001,function()
  496. _new(workspace:FindFirstChild'head_shot'or'sound'){
  497. pitch=math.random(70,100)*0.01;
  498. soundId=url:format(1876552);
  499. name='head_shot';
  500. workspace;
  501. }:play();
  502. end);
  503. _hum_tag(hum);
  504. _rem(_new'part'{
  505. cFrame=CFrame.new(v0,pos)*CFrame.new(0,0,-(v0-pos).magnitude*0.5);
  506. size=Vector3.new(0.1,0.1,(v0-pos).magnitude);
  507. color=torso.Color;
  508. transparency=0.5;
  509. canCollide=false;
  510. bottomSurface=0;
  511. anchored=true;
  512. formFactor=3;
  513. topSurface=0;
  514. inv;
  515. },30);
  516. hit.Parent=nil;
  517. for b=0,1 do
  518. for a=0,1 do
  519. for i=0,1 do
  520. _rem(_new'part'{
  521. velocity=CFrame.new(v0,pos).lookVector*20;
  522. cFrame=hit.CFrame*CFrame.new(i,-b,a);
  523. size=Vector3.new(0.5,0.5,0.5);
  524. color=_RGB(255,255,255);
  525. bottomSurface=0;
  526. canCollide=true;
  527. transparency=0;
  528. formFactor=3;
  529. topSurface=0;
  530. hum;
  531. },30);
  532. end;
  533. end;
  534. end;
  535. end;
  536. end;
  537. end;
  538. end;
  539.  
  540.  
  541.  
  542. _cf_select=function(mouse)
  543. mouse.Icon=url:format(109111387);--108999296
  544. bool_active=true;
  545.  
  546. local arm=char:findFirstChild'Right Arm';
  547. local weld=torso:findFirstChild'Right Shoulder';
  548. if(arm and weld)then
  549. h_weld.Part0=arm;
  550. h_weld.C1=h_weld_cf_active;
  551.  
  552. weld.Part1=nil;
  553. weld.Part0=nil;
  554.  
  555. weld=_new(torso:findFirstChild'right_arml'or'weld'){
  556. name='right_arml';
  557. part0=torso;
  558. part1=arm;
  559. torso;
  560. };
  561.  
  562. arml=(arml or 0)+1;
  563. local alv=arml;
  564. local gyro=torso:findFirstChild'p_gyro'or Instance.new('BodyGyro',torso);
  565. gyro.maxTorque=Vector3.new(5e5,5e5,5e5);
  566. gyro.P=30000;
  567. gyro.D=1000;
  568. gyro.Name='p_gyro';
  569. repeat
  570. local pos=mouse.hit.p;
  571. local val,valp,p0,p1,p2,hitpos,cj,c0,c1;
  572.  
  573. val=-math.pi*0.5;
  574. valp=val*-1;
  575. p0=torso.CFrame;
  576. p0=p0+((p0*CFrame.Angles(valp,0,0)).lookVector*0.5)+(p0*CFrame.Angles(0,val,0)).lookVector;
  577. p1=p0+((p0.p-pos).unit*-2);
  578. p2=CFrame.new((p0.p+p1.p)/2,p0.p)*CFrame.Angles(val,val,0);
  579. hitpos=torso.Position;
  580. cj=CFrame.new(hitpos);
  581. c0=torso.CFrame:inverse()*cj;
  582. c1=p2:inverse()*cj;
  583. weld.C0=c0;
  584. weld.C1=c1;
  585.  
  586. gyro.cframe=CFrame.new(torso.Position,Vector3.new(pos.X,torso.Position.Y,pos.Z));
  587.  
  588. wait(0.001);
  589. until arml~=alv;
  590. gyro.Parent=nil;
  591. end;
  592. end;
  593.  
  594. _cf_deselect=function()
  595. bool_active=false;
  596. arml=(arml or 0)+1;
  597. loop_shot=(loop_shot or 0)+1;
  598.  
  599. h_weld.Part0=torso;
  600. h_weld.C1=h_weld_cf_inactive;
  601.  
  602. local weld=torso:findFirstChild'right_arml';
  603. if(weld)then
  604. weld.Part1=nil;
  605. weld.Part0=nil;
  606. end;
  607. local arm=char:findFirstChild'Right Arm';
  608. local weld=torso:findFirstChild'Right Shoulder';
  609. if(arm and weld)then
  610. weld.Part0=torso;
  611. weld.Part1=arm;
  612. end;
  613. end;
  614.  
  615. _cf_mouse=function(event,fun)
  616. mouse[event:sub(1,1):upper()..event:sub(2)]:connect(function(...)
  617. if(bool_active)then
  618. fun(...);
  619. end;
  620. end);
  621. end;
  622.  
  623.  
  624. do
  625. local main=getfenv(0);
  626. local c=game:children();
  627. local check=function(v)
  628. if(v.className~=''and v.className~='Instance'and game:service(v.className))then
  629. main[v.className:sub(1,1):lower()..v.className:sub(2)]=v;
  630. end;
  631. end;
  632. for i=1,#c do
  633. pcall(check,c[i]);
  634. end;
  635. end;
  636.  
  637.  
  638. bullets={
  639. maximum=51111111111111111111111111110;
  640. current=511111111111111111111111111111110;
  641. clip=501111111111111111111111111111111*4;
  642. };
  643.  
  644. list_base_props={
  645. backgroundColor3=_RGB(0,0,0);
  646. textColor3=_RGB(200,200,200);
  647. borderSizePixel=0;
  648. color=_RGB(0,0,0);
  649. archivable=false;
  650. canCollide=false;
  651. bottomSurface=0;
  652. topSurface=0;
  653. formFactor=0;
  654. locked=true;
  655. };
  656.  
  657.  
  658.  
  659. user=players.localPlayer;
  660. mouse=user:getMouse();
  661. char=user.Character;
  662. gui=user.PlayerGui;
  663. bag=user.Backpack;
  664. torso=char.Torso;
  665. head=char.Head;
  666. hum=_hum(char);
  667.  
  668. url='rbxassetid://%d';
  669. name='dev-uzi';
  670.  
  671. h_weld_cf_inactive=_cframe(0.35,0.5,0.5,
  672. 0,90,-70);
  673. h_weld_cf_active=_cframe(0,0.75,0,
  674. -110,180,0);
  675.  
  676. assert(hum,'humanoid is not found');
  677.  
  678.  
  679.  
  680. _clear();
  681.  
  682.  
  683. _cf_mouse('button1Down',function()
  684. loop_shot=(loop_shot or 0)+1;
  685. local vers=loop_shot;
  686. local step=runService.Stepped;
  687. repeat
  688. _shot((tube.CFrame*CFrame.new(0,0,tube.Size.Z*0.5)).p,mouse.hit.p);
  689. step:wait();--wait(0.001);
  690. until vers~=loop_shot;
  691. end);
  692.  
  693. _cf_mouse('button1Up',function()
  694. loop_shot=(loop_shot or 0)+1;
  695. end);
  696.  
  697. _cf_mouse('move',function()
  698. cross_f.Position=UDim2.new(0,mouse.X-11,0,mouse.Y-11);
  699. end);
  700.  
  701. _cf_mouse('keyDown',function(k)
  702. if(k=='r')then
  703. if(bullets.clip>0 and time_left<=time())then
  704. local got=(bullets.clip>bullets.maximum and
  705. bullets.maximum or
  706. bullets.clip)-bullets.current;
  707.  
  708. bullets.clip=bullets.clip-got;
  709. bullets.current=bullets.current+got;
  710. if(got~=0)then
  711. time_left=time()+2;
  712. end;
  713. end;
  714. end;
  715. end);
  716.  
  717.  
  718. screen=_new'screenGui'{
  719. name=name;
  720. };
  721.  
  722. cross_f=_new'frame'{
  723. size=UDim2.new(0,21,0,21);
  724. backgroundTransparency=1;
  725. screen;
  726. };
  727.  
  728. for i=0,1 do
  729. _new'frame'{
  730. position=UDim2.new(0,13*i,0,11);
  731. size=UDim2.new(0,10,0,1);
  732. cross_f;
  733. };
  734. end;
  735.  
  736. for i=0,1 do
  737. _new'frame'{
  738. position=UDim2.new(0,11,0,13*i);
  739. size=UDim2.new(0,1,0,10);
  740. cross_f;
  741. };
  742. end;
  743.  
  744.  
  745.  
  746. shot_sound=_new(head:findFirstChild'2920959'or'sound'){
  747. soundId=url:format(2920959);
  748. pitch=1.4;
  749. head;
  750. };
  751. if(shot_sound.Name~='2920959')then
  752. shot_sound.Name='2920959';
  753. shot_sound:play();
  754. end;
  755.  
  756. bin=_new'hopperBin'{
  757. deselected=_cf_deselect;
  758. selected=_cf_select;
  759. name=name;
  760. bag;
  761. };
  762.  
  763. inv=_new'model'{
  764. name=name;
  765. char;
  766. };
  767.  
  768. handle=_new'part'{
  769. size=Vector3.new(0.3,1.3,0.4);
  770. color=_RGB(140,140,140);
  771. name='handle';
  772. formFactor=3;
  773. inv;
  774. touched=function(hit)
  775. if(hit.Parent.className=='Model')then
  776. local hum=_hum(hit.Parent);
  777. if(hum~=nil)then
  778. _hum_dam(hum,handle.Velocity.magnitude);
  779. end;
  780. end;
  781. end;
  782. };
  783. h_weld=_new'weld'{
  784. c1=h_weld_cf_inactive;
  785. part1=handle;
  786. part0=torso;
  787. handle;
  788. };
  789. _make_hue();
  790.  
  791. h_part=_new'part'{
  792. size=Vector3.new(0.4,0.4,1.4);
  793. color=_RGB(140,140,140);
  794. name='handle';
  795. formFactor=3;
  796. handle;
  797. };
  798. hp_weld=_new'weld'{
  799. c1=_cframe(0,-1.3/2,-0.3,
  800. 20,0,0);
  801. part0=handle;
  802. part1=h_part;
  803. handle;
  804. };
  805.  
  806. drag=_new'part'{
  807. size=Vector3.new(0.5,0.45,1.5);
  808. color=_RGB(100,100,100);
  809. name='handle';
  810. formFactor=3;
  811. handle;
  812. };
  813. d_weld=_new'weld'{
  814. c1=_cframe(0,-0.25,0);
  815. part0=h_part;
  816. part1=drag;
  817. handle;
  818. };
  819.  
  820. tube=_new'part'{
  821. size=Vector3.new(0.2,0.2,1.5);
  822. color=_RGB(0,0,0);
  823. name='handle';
  824. formFactor=3;
  825. handle;
  826. };
  827. t_weld=_new'weld'{
  828. c1=_cframe(0,-0.3,-0.1);
  829. part0=h_part;
  830. part1=tube;
  831. handle;
  832. };
  833.  
  834. bullets_label=_new'textLabel'{
  835. textStrokeColor3=_RGB(0,0,0);
  836. textColor3=_RGB(200,200,200);
  837. textStrokeTransparency=0;
  838. backgroundTransparency=1;
  839. fontSize=5;
  840. screen;
  841. };
  842.  
  843. lightstuff=_new'frame'{
  844. backgroundColor3=_RGB(255,255,255);
  845. position=UDim2.new(0,0,0,-1);
  846. backgroundTransparency=0.5;
  847. size=UDim2.new(1,0,1,1);
  848. borderSizePixel=0;
  849. visible=false;
  850. screen;
  851. };
  852.  
  853. coroutine.wrap(function()
  854. local red,white,green;
  855. repeat
  856. if(screen.Parent)then
  857. if(not green and bullets.current==bullets.maximum)then
  858. green=true;
  859. bullets_label.TextColor3=_RGB(0,200,0);
  860. elseif(not red and bullets.current==0)then
  861. red=true;
  862. bullets_label.TextColor3=_RGB(200,0,0);
  863. elseif((red or green)and bullets.current~=0 and bullets.current~=bullets.maximum)then
  864. bullets_label.TextColor3=_RGB(200,200,200);
  865. green=false;
  866. red=false;
  867. end;
  868. bullets_label.Text=('Bullets: %d/%d'):format(bullets.current,bullets.clip);
  869. bullets_label.Size=UDim2.new(0,bullets_label.TextBounds.X,0,bullets_label.TextBounds.Y);
  870. bullets_label.Position=UDim2.new(1,-bullets_label.TextBounds.X-6,1,-bullets_label.TextBounds.Y-6);
  871. end;
  872. wait(0.001);
  873. until nil;
  874. end)();
  875.  
  876.  
  877. _G.dev_pistol_version=(_G.dev_pistol_version or 0)+1;
  878. local vers=_G.dev_pistol_version;
  879. repeat _update();wait(0.001);until _G.dev_pistol_version~=vers or hum.Health==0;
  880. if(hum.Health==0)then
  881. _clear();
  882. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement