Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ChangeIndex,WaitForChild,GetService=
- function(tab,indexes,isprinted)for a,b in pairs(indexes)do local _,c=pcall(function()tab[a]=b;end);
- if isprinted and c then print(c);end;end;end,function(par,ch,wt)repeat local a=par:FindFirstChild(ch);
- if a then return a;end;wait(wt or 1/60);until nil;end,function(a)return game:GetService(a);end;
- local InstanceNew,WaitForDescendant,Services=
- function(cn,prop)local a=Instance.new(cn);ChangeIndex(a,prop,1);return a;end,function(par,tab_of_ch,
- wt)for _,a in pairs(tab_of_ch)do par=WaitForChild(par,a,wt);end;return par;end,{
- Players=GetService'Players';
- Debris=GetService'Debris';
- };
- local Tool=script:FindFirstAncestorWhichIsA'Tool'or(function()
- local a=InstanceNew('Tool',{Name='Revolver';Parent=getfenv().owner.Character;Grip=
- CFrame.new(.121399522,-.479449034,.202182412,1,0,0,0,1,0,0,0,1)});
- local b=InstanceNew('Part',{Name='Handle';Parent=a;Size=Vector3.new(.2,.7,1.3);});
- InstanceNew('Attachment',{Name='BarrelAttachment';Parent=b;Position=Vector3.new(-.006,.261,.12);});
- InstanceNew('Attachment',{Name='NozzleAttachment';Parent=b;Position=Vector3.new(-.002,.25,-.634);});
- InstanceNew('SpecialMesh',{MeshId='http://www.roblox.com/asset/?id=97886770';Parent=b;TextureId=
- 'http://www.roblox.com/asset/?id=97888197';});
- local c=InstanceNew('Folder',{Name='Replicatables';Parent=a;});
- local d=InstanceNew('ScreenGui',{ResetOnSpawn=false;Name='a';Parent=c;});
- InstanceNew('Frame',{Parent=d;Name='a';AnchorPoint=Vector2.new(1,1);BackgroundTransparency=1;Position=
- UDim2.new(1,0,1,0);Size=UDim2.new(.125,0,.125,0);ClipsDescendants=true;});
- InstanceNew('TextButton',{Name='b';Parent=c;AutoButtonColor=false;BackgroundTransparency=1;Size=UDim2.
- new(1,0,1,0);Font='Code';Text='6';TextScaled=true;TextColor3=Color3.fromRGB(255,255,255);
- TextStrokeTransparency=0});
- InstanceNew('Sound',{Name='ReloadSound';SoundId='rbxassetid://97848255';Volume=2;Parent=b;});
- InstanceNew('Sound',{Name='FireSound';SoundId='rbxassetid://97848313';Volume=4;Parent=b;});
- return a;
- end)();
- script.Parent=Tool;
- local Tool=script.Parent;
- local NLS=getfenv()['NLS'];
- if NLS then
- NLS('print"https://pastebin.com/raw/QJWZP3AG";'..[[local ChangeIndex,WaitForChild,GetService=
- function(tab,indexes,isprinted)for a,b in pairs(indexes)do local _,c=pcall(function()tab[a]=b;end);
- if isprinted and c then print(c);end;end;end,function(par,ch,wt)repeat local a=par:FindFirstChild(ch);
- if a then return a;end;wait(wt or 1/60);until nil;end,function(a)return game:GetService(a);end;
- local InstanceNew,WaitForDescendant,Services=
- function(cn,prop)local a=Instance.new(cn);ChangeIndex(cn,prop,1);return a;end,function(par,tab_of_ch,
- wt)for _,a in pairs(tab_of_ch)do par=WaitForChild(par,a,wt);end;return par;end,{
- Players=GetService'Players';
- };
- local Tool,LocalPlayer=script.Parent,Services.Players.LocalPlayer;
- local Handle,Mouse=Tool.Handle,LocalPlayer:GetMouse();
- local RE,RF=WaitForDescendant(Tool,{'a';'RE';}),WaitForDescendant(Tool,{'a';'RF';});
- local FireServer,InvokeServer=function(...)RE:FireServer(...);end,function(...)return RF:InvokeServer(...
- );end;
- local BulletGui,SetBullets=nil,function()end;
- local Reloadable=true;
- Mouse.KeyDown:Connect(function(key)
- if key~='r'or not Reloadable then return;end;
- Reloadable=false;
- local Bullets=InvokeServer'GetBullets';
- if Bullets==6 then Reloadable=true;return;end;
- FireServer'ReloadSound';
- local a=3;
- if Bullets~=0 then
- SetBullets(0);
- a=2.9;
- end;
- FireServer'ReloadGun';
- SetBullets(6,a);
- Reloadable=true;
- end);
- Mouse.Button1Down:Connect(function()
- if not Reloadable then return;end;
- Reloadable=false;
- local Bullets=InvokeServer('FireGun',Mouse.Hit,Mouse.Target);
- SetBullets(Bullets);
- wait(.1);
- Reloadable=true;
- end);
- Tool.Equipped:Connect(function()
- if not Reloadable then return;end;
- Reloadable=false;
- FireServer'GetGui';
- wait(1);
- BulletGui=WaitForChild(LocalPlayer:FindFirstChildWhichIsA'PlayerGui','a');
- SetBullets=function(a,e)e=e or 1;
- local b=BulletGui.a:FindFirstChild(tostring(a));
- if not b then return;end;
- local c=b.Position.X.Scale;
- if c==0 then return;end;
- for _,d in pairs(BulletGui.a:GetChildren())do
- d:TweenPosition(d.Position+UDim2.new(-c,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,
- e);
- end;
- wait(e);
- end;
- SetBullets(InvokeServer'GetBullets');
- Reloadable=true;
- end);
- Tool.Unequipped:Connect(function()
- FireServer'RemoveGui'--?
- end);
- ]],Tool);
- end;
- local Handle,RemoteFolder=Tool.Handle,InstanceNew('Folder',{Parent=Tool;Name='a';});
- local RemoteEvent,RemoteFunction=InstanceNew('RemoteEvent',{Parent=RemoteFolder;Name='RE';}),
- InstanceNew('RemoteFunction',{Parent=RemoteFolder;Name='RF';});
- local Replicatables=Tool.Replicatables;
- local ReloadSound=Handle.ReloadSound;
- local Bullets=6;
- local Damage=function(h,d)
- if not h then return;end;
- local a=h:FindFirstAncestorWhichIsA'Model';
- if not a then return;end;
- local b,c=a:FindFirstChildWhichIsA'Humanoid',a:FindFirstChild'Head'or a:FindFirstChild'Torso'or
- a:FindFirstChild'UpperTorso'or a:FindFirstChild'HumanoidRootPart';
- if b then
- if b.Health>101 then
- b.Health=0;
- else
- b:TakeDamage(d);
- end;
- elseif c then
- c:Destroy();
- else
- pcall(function()a:BreakJoints();end);
- end;
- end;
- local RemoteHandler=function(Player,...)
- local a=Tool:FindFirstAncestorWhichIsA'Model';
- if not a then return;end;
- local b=Services.Players:GetPlayerFromCharacter(a);
- if not b or a==workspace then return;end;
- if b~=Player then return;end;
- local args={...};
- return({
- GetGui=function()
- local f=Player:FindFirstChildWhichIsA'PlayerGui';
- if f then
- if f:FindFirstChild'a'then return;end;
- end;
- local a=Replicatables.a:Clone();
- local d={};
- for b=1,6 do
- local c=Replicatables.b:Clone();
- ChangeIndex(c,{Parent=a.a;Name=tostring(b);Text=tostring(b);});
- for _,e in pairs(d)do
- e.Position=e.Position+UDim2.new(-1,0,0,0);
- end;
- table.insert(d,c);
- end;
- local c=Replicatables.b:Clone();
- ChangeIndex(c,{Parent=a.a;Name='0';Text='0';Position=UDim2.new(-6,0,0,0) });
- a.Parent=f;
- a.a:TweenPosition(UDim2.new(1,0,1,0));
- end;
- GetBullets=function()return Bullets;end;
- FireGun=function()
- if Bullets<1 then return;end;
- Bullets=Bullets-1;
- local Hit,Target=args[2],args[3];
- local a,b=Handle.NozzleAttachment.WorldPosition,Handle.BarrelAttachment.WorldPosition;
- local Ray1=Ray.new(a,CFrame.new(a,b).LookVector*(a-b).Magnitude);
- --so that you cant shoot thru walls
- local Ray2=Ray.new(a,CFrame.new(a,Hit.p).LookVector*(a-Hit.p).Magnitude);
- local Target2,Hit2=workspace:FindPartOnRayWithIgnoreList(Ray2,Player.Character:GetDescendants());
- local Target3=workspace:FindPartOnRayWithWhitelist(Ray2,(function()
- local c={};
- for _,d in pairs(workspace:GetChildren())do
- (function()
- if not d then return;end;
- local f=d:FindFirstChild'Head';
- if not f then return;end;
- table.insert(c,f);
- end)();
- end;
- return c;
- end)());
- local BulletTrail=InstanceNew('Part',{Parent=workspace;CFrame=CFrame.new(a,Hit2);Anchored=
- true;CanCollide=false;Size=Vector3.new(.05,.05,(Hit2-a).Magnitude);BrickColor=BrickColor
- .new("New Yeller")});
- BulletTrail.CFrame=BulletTrail.CFrame*CFrame.new(0,0,-BulletTrail.Size.Z/2);
- Services.Debris:AddItem(BulletTrail,.1);
- Handle.FireSound:Play();
- Damage(Target2,25);
- (function()
- if not Target3 then return;end;
- local c=Target3:FindFirstAncestorWhichIsA'Model';
- local d=Target2:FindFirstAncestorWhichIsA'Model';
- if not(c and d)then return;end;
- if c~=d or c==workspace or d==workspace then return;end;
- Damage(Target2,25);
- end)();
- return Bullets;
- end;
- ReloadGun=function()
- if Bullets~=0 then
- wait(1);
- Bullets=0;
- else
- ReloadSound.TimePosition=1.4;ReloadSound:Play();
- end;
- wait(2);
- Bullets=6;
- end;
- ReloadSound=function()ReloadSound:Play();end;
- RemoveGui=function()
- local a=Player:FindFirstChildWhichIsA'PlayerGui';
- print(1)
- if not a then return;end;
- print(2)
- local b=a:FindFirstChild'a';
- if not b then return;end;
- b.a:TweenPosition(UDim2.new(1,0,1.125,0));
- wait(1.1);
- b:Destroy();
- end;
- })[args[1]]();
- end;
- RemoteEvent.OnServerEvent:Connect(RemoteHandler);RemoteFunction.OnServerInvoke=RemoteHandler;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement