Advertisement
InTesting

Revolver

Mar 22nd, 2020
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.32 KB | None | 0 0
  1. local ChangeIndex,WaitForChild,GetService=
  2.     function(tab,indexes,isprinted)for a,b in pairs(indexes)do local _,c=pcall(function()tab[a]=b;end);
  3.     if isprinted and c then print(c);end;end;end,function(par,ch,wt)repeat local a=par:FindFirstChild(ch);
  4.     if a then return a;end;wait(wt or 1/60);until nil;end,function(a)return game:GetService(a);end;
  5. local InstanceNew,WaitForDescendant,Services=
  6.     function(cn,prop)local a=Instance.new(cn);ChangeIndex(a,prop,1);return a;end,function(par,tab_of_ch,
  7.     wt)for _,a in pairs(tab_of_ch)do par=WaitForChild(par,a,wt);end;return par;end,{
  8.     Players=GetService'Players';
  9.     Debris=GetService'Debris';
  10.     };
  11. local Tool=script:FindFirstAncestorWhichIsA'Tool'or(function()
  12.     local a=InstanceNew('Tool',{Name='Revolver';Parent=getfenv().owner.Character;Grip=
  13.         CFrame.new(.121399522,-.479449034,.202182412,1,0,0,0,1,0,0,0,1)});
  14.     local b=InstanceNew('Part',{Name='Handle';Parent=a;Size=Vector3.new(.2,.7,1.3);});
  15.     InstanceNew('Attachment',{Name='BarrelAttachment';Parent=b;Position=Vector3.new(-.006,.261,.12);});
  16.     InstanceNew('Attachment',{Name='NozzleAttachment';Parent=b;Position=Vector3.new(-.002,.25,-.634);});
  17.     InstanceNew('SpecialMesh',{MeshId='http://www.roblox.com/asset/?id=97886770';Parent=b;TextureId=
  18.     'http://www.roblox.com/asset/?id=97888197';});
  19.     local c=InstanceNew('Folder',{Name='Replicatables';Parent=a;});
  20.     local d=InstanceNew('ScreenGui',{ResetOnSpawn=false;Name='a';Parent=c;});
  21.     InstanceNew('Frame',{Parent=d;Name='a';AnchorPoint=Vector2.new(1,1);BackgroundTransparency=1;Position=
  22.         UDim2.new(1,0,1,0);Size=UDim2.new(.125,0,.125,0);ClipsDescendants=true;});
  23.     InstanceNew('TextButton',{Name='b';Parent=c;AutoButtonColor=false;BackgroundTransparency=1;Size=UDim2.
  24.         new(1,0,1,0);Font='Code';Text='6';TextScaled=true;TextColor3=Color3.fromRGB(255,255,255);
  25.         TextStrokeTransparency=0});
  26.     InstanceNew('Sound',{Name='ReloadSound';SoundId='rbxassetid://97848255';Volume=2;Parent=b;});
  27.     InstanceNew('Sound',{Name='FireSound';SoundId='rbxassetid://97848313';Volume=4;Parent=b;});
  28.     return a;
  29.     end)();
  30. script.Parent=Tool;
  31. local Tool=script.Parent;
  32. local NLS=getfenv()['NLS'];
  33. if NLS then
  34.     NLS('print"https://pastebin.com/raw/QJWZP3AG";'..[[local ChangeIndex,WaitForChild,GetService=
  35.     function(tab,indexes,isprinted)for a,b in pairs(indexes)do local _,c=pcall(function()tab[a]=b;end);
  36.     if isprinted and c then print(c);end;end;end,function(par,ch,wt)repeat local a=par:FindFirstChild(ch);
  37.     if a then return a;end;wait(wt or 1/60);until nil;end,function(a)return game:GetService(a);end;
  38. local InstanceNew,WaitForDescendant,Services=
  39.     function(cn,prop)local a=Instance.new(cn);ChangeIndex(cn,prop,1);return a;end,function(par,tab_of_ch,
  40.     wt)for _,a in pairs(tab_of_ch)do par=WaitForChild(par,a,wt);end;return par;end,{
  41.     Players=GetService'Players';
  42.     };
  43.    
  44. local Tool,LocalPlayer=script.Parent,Services.Players.LocalPlayer;
  45. local Handle,Mouse=Tool.Handle,LocalPlayer:GetMouse();
  46. local RE,RF=WaitForDescendant(Tool,{'a';'RE';}),WaitForDescendant(Tool,{'a';'RF';});
  47. local FireServer,InvokeServer=function(...)RE:FireServer(...);end,function(...)return RF:InvokeServer(...
  48.     );end;
  49. local BulletGui,SetBullets=nil,function()end;
  50. local Reloadable=true;
  51. Mouse.KeyDown:Connect(function(key)
  52.     if key~='r'or not Reloadable then return;end;
  53.     Reloadable=false;
  54.     local Bullets=InvokeServer'GetBullets';
  55.     if Bullets==6 then Reloadable=true;return;end;
  56.     FireServer'ReloadSound';
  57.     local a=3;
  58.     if Bullets~=0 then
  59.         SetBullets(0);
  60.         a=2.9;
  61.     end;
  62.     FireServer'ReloadGun';
  63.     SetBullets(6,a);
  64.    
  65.     Reloadable=true;
  66. end);
  67. Mouse.Button1Down:Connect(function()
  68.     if not Reloadable then return;end;
  69.     Reloadable=false;
  70.     local Bullets=InvokeServer('FireGun',Mouse.Hit,Mouse.Target);
  71.     SetBullets(Bullets);
  72.     wait(.1);
  73.     Reloadable=true;
  74. end);
  75. Tool.Equipped:Connect(function()
  76.     if not Reloadable then return;end;
  77.     Reloadable=false;
  78.     FireServer'GetGui';
  79.     wait(1);
  80.     BulletGui=WaitForChild(LocalPlayer:FindFirstChildWhichIsA'PlayerGui','a');
  81.     SetBullets=function(a,e)e=e or 1;
  82.         local b=BulletGui.a:FindFirstChild(tostring(a));
  83.         if not b then return;end;
  84.         local c=b.Position.X.Scale;
  85.         if c==0 then return;end;
  86.         for _,d in pairs(BulletGui.a:GetChildren())do
  87.             d:TweenPosition(d.Position+UDim2.new(-c,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,
  88.                 e);
  89.         end;
  90.         wait(e);
  91.     end;
  92.     SetBullets(InvokeServer'GetBullets');
  93.     Reloadable=true;
  94. end);
  95. Tool.Unequipped:Connect(function()
  96.     FireServer'RemoveGui'--?
  97. end);
  98.         ]],Tool);
  99.    
  100. end;
  101. local Handle,RemoteFolder=Tool.Handle,InstanceNew('Folder',{Parent=Tool;Name='a';});
  102. local RemoteEvent,RemoteFunction=InstanceNew('RemoteEvent',{Parent=RemoteFolder;Name='RE';}),
  103.     InstanceNew('RemoteFunction',{Parent=RemoteFolder;Name='RF';});
  104. local Replicatables=Tool.Replicatables;
  105. local ReloadSound=Handle.ReloadSound;
  106. local Bullets=6;
  107. local Damage=function(h,d)
  108.     if not h then return;end;
  109.     local a=h:FindFirstAncestorWhichIsA'Model';
  110.     if not a then return;end;
  111.     local b,c=a:FindFirstChildWhichIsA'Humanoid',a:FindFirstChild'Head'or a:FindFirstChild'Torso'or
  112.         a:FindFirstChild'UpperTorso'or a:FindFirstChild'HumanoidRootPart';
  113.     if b then
  114.         if b.Health>101 then
  115.             b.Health=0;
  116.         else
  117.             b:TakeDamage(d);
  118.         end;
  119.     elseif c then
  120.         c:Destroy();
  121.     else
  122.         pcall(function()a:BreakJoints();end);
  123.     end;
  124. end;
  125. local RemoteHandler=function(Player,...)
  126.     local a=Tool:FindFirstAncestorWhichIsA'Model';
  127.     if not a then return;end;  
  128.     local b=Services.Players:GetPlayerFromCharacter(a);
  129.     if not b or a==workspace then return;end;
  130.     if b~=Player then return;end;
  131.     local args={...};
  132.     return({
  133.         GetGui=function()
  134.             local f=Player:FindFirstChildWhichIsA'PlayerGui';
  135.             if f then
  136.                 if f:FindFirstChild'a'then return;end;
  137.             end;
  138.             local a=Replicatables.a:Clone();
  139.             local d={};
  140.             for b=1,6 do
  141.                 local c=Replicatables.b:Clone();
  142.                 ChangeIndex(c,{Parent=a.a;Name=tostring(b);Text=tostring(b);});
  143.                 for _,e in pairs(d)do
  144.                     e.Position=e.Position+UDim2.new(-1,0,0,0);
  145.                 end;
  146.                 table.insert(d,c);
  147.             end;
  148.             local c=Replicatables.b:Clone();
  149.             ChangeIndex(c,{Parent=a.a;Name='0';Text='0';Position=UDim2.new(-6,0,0,0) });
  150.             a.Parent=f;
  151.             a.a:TweenPosition(UDim2.new(1,0,1,0));
  152.         end;
  153.         GetBullets=function()return Bullets;end;
  154.         FireGun=function()
  155.             if Bullets<1 then return;end;
  156.             Bullets=Bullets-1;
  157.             local Hit,Target=args[2],args[3];
  158.             local a,b=Handle.NozzleAttachment.WorldPosition,Handle.BarrelAttachment.WorldPosition;
  159.             local Ray1=Ray.new(a,CFrame.new(a,b).LookVector*(a-b).Magnitude);
  160.             --so that you cant shoot thru walls
  161.             local Ray2=Ray.new(a,CFrame.new(a,Hit.p).LookVector*(a-Hit.p).Magnitude);
  162.             local Target2,Hit2=workspace:FindPartOnRayWithIgnoreList(Ray2,Player.Character:GetDescendants());
  163.             local Target3=workspace:FindPartOnRayWithWhitelist(Ray2,(function()
  164.                 local c={};
  165.                 for _,d in pairs(workspace:GetChildren())do
  166.                     (function()
  167.                         if not d then return;end;
  168.                         local f=d:FindFirstChild'Head';
  169.                         if not f then return;end;
  170.                         table.insert(c,f);
  171.                     end)();
  172.                 end;
  173.                 return c;
  174.             end)());
  175.             local BulletTrail=InstanceNew('Part',{Parent=workspace;CFrame=CFrame.new(a,Hit2);Anchored=
  176.                 true;CanCollide=false;Size=Vector3.new(.05,.05,(Hit2-a).Magnitude);BrickColor=BrickColor
  177.                 .new("New Yeller")});
  178.             BulletTrail.CFrame=BulletTrail.CFrame*CFrame.new(0,0,-BulletTrail.Size.Z/2);
  179.             Services.Debris:AddItem(BulletTrail,.1);
  180.             Handle.FireSound:Play();
  181.             Damage(Target2,25);
  182.             (function()
  183.                 if not Target3 then return;end;
  184.                 local c=Target3:FindFirstAncestorWhichIsA'Model';
  185.                 local d=Target2:FindFirstAncestorWhichIsA'Model';
  186.                 if not(c and d)then return;end;
  187.                 if c~=d or c==workspace or d==workspace then return;end;
  188.                 Damage(Target2,25);
  189.             end)();
  190.             return Bullets;
  191.         end;
  192.         ReloadGun=function()
  193.            
  194.             if Bullets~=0 then
  195.                 wait(1);
  196.                 Bullets=0;
  197.             else
  198.                 ReloadSound.TimePosition=1.4;ReloadSound:Play();
  199.             end;
  200.            
  201.             wait(2);
  202.             Bullets=6;
  203.         end;
  204.         ReloadSound=function()ReloadSound:Play();end;
  205.         RemoveGui=function()
  206.             local a=Player:FindFirstChildWhichIsA'PlayerGui';
  207.             print(1)
  208.             if not a then return;end;
  209.             print(2)
  210.             local b=a:FindFirstChild'a';
  211.             if not b then return;end;
  212.             b.a:TweenPosition(UDim2.new(1,0,1.125,0));
  213.             wait(1.1);
  214.             b:Destroy();
  215.         end;
  216.         })[args[1]]();
  217. end;
  218.  
  219.  
  220.  
  221. RemoteEvent.OnServerEvent:Connect(RemoteHandler);RemoteFunction.OnServerInvoke=RemoteHandler;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement