Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Decompiled with the Synapse X Luau decompiler.
- game.Players.LocalPlayer.Backpack.Shotgun.LocalScript:Destroy()
- script.Parent = game.Players.LocalPlayer.Backpack.Shotgun
- local l__RenderStepped__1 = game:GetService("RunService").RenderStepped;
- local l__LocalPlayer__2 = game.Players.LocalPlayer;
- local l__mouse__3 = l__LocalPlayer__2:GetMouse();
- local u1 = false;
- local u2 = nil;
- local l__WeaponDisplay__3 = script.Parent:WaitForChild("WeaponDisplay");
- local u4 = math.huge;
- local u5 = false;
- local u6 = nil;
- local u7 = nil;
- script.Parent.Equipped:connect(function()
- u1 = true;
- u2 = l__WeaponDisplay__3:Clone();
- u2.Parent = game.Players.LocalPlayer.PlayerGui;
- u2.Frame.Ammo.Text = u4 .. " / " .. 4;
- game:GetService("ContextActionService"):BindAction("Reload", reload, false, "r");
- game:GetService("UserInputService").InputBegan:connect(function(p1)
- if p1.KeyCode == Enum.KeyCode.ButtonX then
- reload();
- end;
- end);
- u2.Frame.ReloadReminder.MouseButton1Click:connect(reload);
- u2.Frame.ShootButton.MouseButton1Down:connect(fireWeapon);
- if game:GetService("UserInputService").GamepadEnabled then
- u2.Frame.ReloadReminder.xboxHint.Visible = true;
- u2.Frame.ShootButton.xboxHint.Visible = true;
- end;
- if game:GetService("UserInputService").TouchEnabled == true then
- u2.Frame.Size = UDim2.new(0.1, 0, 0.1, 0);
- u2.Frame.Position = UDim2.new(1, -10, 0.4, 0);
- u2.Frame.ShootButton.Visible = true;
- u2.MobileAim.Visible = true;
- u5 = true;
- end;
- u6 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Idle);
- u7 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Shoot);
- u6:Play();
- end);
- local u8 = false;
- local u9 = false;
- script.Parent.Unequipped:connect(function()
- u1 = false;
- u8 = false;
- u9 = false;
- local l__WeaponDisplay__4 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
- if l__WeaponDisplay__4 then
- l__WeaponDisplay__4:Destroy();
- end;
- u6:Stop();
- u7:Stop();
- game:GetService("ContextActionService"):UnbindAction("Reload");
- end);
- game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
- local l__WeaponDisplay__5 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
- if l__WeaponDisplay__5 then
- l__WeaponDisplay__5:Destroy();
- end;
- end);
- l__mouse__3.Button1Down:connect(function()
- if not u5 then
- while wait() do
- fireWeapon();
- end
- end;
- end);
- local u10 = 0;
- local l__Projectiles__11 = game.Workspace.Events.Projectiles;
- local u12 = 0;
- function fireWeapon()
- if u1 then
- if not u8 then
- if not u9 then
- if game:GetService("UserInputService").GamepadEnabled then
- u2.Frame.ReloadReminder.xboxHint.Visible = true;
- end;
- if u4 == 0 then
- u2.Frame.ReloadReminder.Visible = true;
- return;
- end;
- u8 = true;
- u4 = u4 - 1;
- if u4 == 0 then
- u2.Frame.ReloadReminder.Visible = true;
- end;
- u2.Frame.Ammo.Text = u4 .. " / " .. 4;
- local v6 = script.Parent.Handle.FireSound:Clone();
- v6.Parent = script.Parent.Handle;
- v6:Destroy();
- game.Workspace.Events.Projectiles.GunSound:FireServer(script.Parent.Handle);
- u7:Play();
- if l__LocalPlayer__2.Character then
- if 0 < l__LocalPlayer__2.Character.Humanoid.Health then
- local v7 = l__mouse__3.Hit;
- if u5 then
- local l__AbsolutePosition__8 = u2.MobileAim.AbsolutePosition;
- local l__AbsoluteSize__9 = u2.MobileAim.AbsoluteSize;
- local l__Magnitude__10 = (l__LocalPlayer__2.Character.Head.Position - game.Workspace.CurrentCamera.CFrame.p).Magnitude;
- local v11 = game.Workspace.CurrentCamera:ScreenPointToRay(l__AbsolutePosition__8.X + l__AbsoluteSize__9.X / 2, l__AbsolutePosition__8.Y + l__AbsoluteSize__9.Y / 2, 0);
- local v12, v13 = game.Workspace:FindPartOnRay(Ray.new(v11.Origin, v11.Direction * 10000), l__LocalPlayer__2.Character);
- v7 = CFrame.new(v13);
- end;
- local l__Position__13 = script.Parent.Handle.Position;
- local function v14()
- u10 = u10 + 1;
- local v15 = CFrame.new(l__Position__13, v7.p).lookVector + Vector3.new(math.random(-50, 50) / 1000, math.random(-50, 50) / 1000, math.random(-50, 50) / 1000);
- l__Projectiles__11.ProjectileRenderEvent:FireServer(0, l__LocalPlayer__2.Name, u10, l__Position__13, v7, 20, 500, "Shotgun");
- local v16 = game.ReplicatedStorage.ProjectileShotgun:Clone();
- v16.Parent = game.Workspace;
- local v17 = 0;
- local v18 = 2;
- while true do
- if v17 < 500 then
- else
- break;
- end;
- local v19, v20 = game.Workspace:FindPartOnRay(Ray.new(l__Position__13, v15.unit * v18), game.Players.LocalPlayer.Character, true, true);
- if not v19 then
- v16.CFrame = CFrame.new(v20, v20 + v15);
- else
- if v19.Name ~= "ProjectileShotgun" then
- local l__Body__21 = v19.Parent:FindFirstChild("Body");
- if l__Body__21 then
- l__Projectiles__11.HealthChange:FireServer(l__Body__21.Parent.OwnerName.Value, 9, u12);
- end;
- local l__Body__22 = v19.Parent.Parent:FindFirstChild("Body");
- if l__Body__22 then
- l__Projectiles__11.HealthChange:FireServer(l__Body__22.Parent.OwnerName.Value, 9, u12);
- end;
- l__Projectiles__11.ProjectileRenderEvent:FireServer(1, l__LocalPlayer__2.Name, u10, l__Position__13, v7, 20, 500, "Shotgun", v19, u12);
- break;
- end;
- v16.CFrame = CFrame.new(v20, v20 + v15);
- end;
- if v18 * 2 < 20 then
- v18 = v18 * 2;
- elseif v18 ~= 20 then
- v18 = 20;
- end;
- v17 = v17 + v18;
- l__RenderStepped__1:wait();
- end;
- v16:Destroy();
- end;
- local v23 = 1 - 1;
- while true do
- coroutine.wrap(v14)();
- if 0 <= 1 then
- if v23 < 5 then
- else
- break;
- end;
- elseif 5 < v23 then
- else
- break;
- end;
- v23 = v23 + 1;
- end;
- end;
- end;
- u8 = false;
- u7:Stop();
- end;
- end;
- end;
- end;
- local u14 = 0;
- function reload()
- if u9 then
- return;
- end;
- u10 = 0;
- u14 = u14 + 1;
- u9 = true;
- u8 = false;
- script.Parent.Handle.ReloadSound:Play();
- if u14 ~= u14 then
- print("cancel reload");
- return;
- end;
- u4 = math.huge;
- u2.Frame.Ammo.Text = u4 .. " / " .. 4;
- u2.Frame.ReloadReminder.Visible = false;
- u9 = false;
- end;
- game.Workspace.Events.S.SEvent.OnClientEvent:connect(function(p2)
- u12 = p2;
- end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement