Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Decompiled with the Synapse X Luau decompiler.
- game.Players.LocalPlayer.Backpack["Squid Sniper"].LocalScript:Destroy()
- script.Parent = game.Players.LocalPlayer.Backpack["Squid Sniper"]
- local l__RenderStepped__1 = game:GetService("RunService").RenderStepped;
- local l__WeaponDisplay__2 = script.Parent:WaitForChild("WeaponDisplay");
- local l__RenderStepped__3 = game:GetService("RunService").RenderStepped;
- local l__LocalPlayer__4 = game.Players.LocalPlayer;
- local l__mouse__5 = l__LocalPlayer__4:GetMouse();
- local l__UserInputService__6 = game:GetService("UserInputService");
- local l__LocalPlayer__7 = game:GetService("Players").LocalPlayer;
- local l__Head__8 = l__LocalPlayer__7.Character:WaitForChild("Head", false);
- local l__mouse__9 = l__LocalPlayer__7:GetMouse();
- game:GetService("UserInputService").InputBegan:connect(function(p1)
- if p1.KeyCode == Enum.KeyCode.ButtonX then
- reload();
- return;
- end;
- if p1.KeyCode == Enum.KeyCode.ButtonL2 then
- zoomToggle();
- end;
- end);
- local u1 = false;
- local u2 = false;
- local u3 = nil;
- local u4 = math.huge;
- local u5 = {
- FieldOfView = nil,
- _CFrame = nil,
- MouseBehavior = nil,
- MouseDeltaSensitivity = nil
- };
- local l__CurrentCamera__6 = game.Workspace.CurrentCamera;
- local u7 = false;
- local u8 = nil;
- local u9 = nil;
- script.Parent.Equipped:connect(function()
- u1 = true;
- u2 = false;
- u3 = l__WeaponDisplay__2:Clone();
- u3.Parent = game.Players.LocalPlayer.PlayerGui;
- u3.Frame.Ammo.Text = u4 .. " / " .. 5;
- game:GetService("ContextActionService"):BindAction("Reload", reload, false, "r");
- u3.Frame.ReloadReminder.MouseButton1Click:connect(reload);
- u3.Frame.ShootButton.MouseButton1Down:connect(fireWeapon);
- u3.Frame.Zoom.MouseButton1Click:connect(zoomToggle);
- u5._CFrame = l__CurrentCamera__6.CFrame;
- u5.FieldOfView = l__CurrentCamera__6.FieldOfView;
- u5.MouseBehavior = l__UserInputService__6.MouseBehavior;
- u5.MouseDeltaSensitivity = l__UserInputService__6.MouseDeltaSensitivity;
- if l__UserInputService__6.GamepadEnabled then
- u3.Frame.ReloadReminder.xboxHint.Visible = true;
- u3.Frame.ShootButton.xboxHint.Visible = true;
- u3.Frame.Zoom.xboxHint.Visible = true;
- end;
- if game:GetService("UserInputService").TouchEnabled == true then
- u3.Frame.Size = UDim2.new(0.1, 0, 0.1, 0);
- u3.Frame.Position = UDim2.new(1, -10, 0.4, 0);
- u3.Frame.ShootButton.Visible = true;
- u3.MobileAim.Visible = true;
- u7 = true;
- end;
- u8 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Idle);
- u9 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Shoot);
- u8:Play();
- end);
- script.Parent.ChildRemoved:Connect(function()
- print("gun gone");
- ResetCamera();
- end);
- game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
- print("died");
- ResetCamera();
- end);
- local u10 = false;
- local u11 = false;
- script.Parent.Unequipped:connect(function()
- u2 = false;
- u1 = false;
- u10 = false;
- u11 = false;
- ResetCamera();
- local l__WeaponDisplay__10 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
- if l__WeaponDisplay__10 then
- l__WeaponDisplay__10:Destroy();
- end;
- game:GetService("ContextActionService"):UnbindAction("Reload");
- u8:Stop();
- u9:Stop();
- end);
- game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
- local l__WeaponDisplay__11 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
- if l__WeaponDisplay__11 then
- l__WeaponDisplay__11:Destroy();
- end;
- end);
- l__mouse__5.Button1Down:connect(function()
- if not u7 then
- while wait() do
- fireWeapon();
- end
- end;
- end);
- local l__Projectiles__12 = game.Workspace.Events.Projectiles;
- local u13 = 0;
- function fireWeapon()
- if u1 then
- if not u10 then
- if not u11 then
- if game:GetService("UserInputService").GamepadEnabled then
- u3.Frame.ReloadReminder.xboxHint.Visible = true;
- end;
- if u4 == 0 then
- u3.Frame.ReloadReminder.Visible = true;
- return;
- end;
- u10 = true;
- u4 = u4 - 1;
- if u4 == 0 then
- u3.Frame.ReloadReminder.Visible = true;
- end;
- u3.Frame.Ammo.Text = u4 .. " / " .. 5;
- local v12 = script.Parent.Handle.FireSound:Clone();
- v12.Parent = script.Parent.Handle;
- v12:Destroy();
- game.Workspace.Events.Projectiles.GunSound:FireServer(script.Parent.Handle);
- u9:Play();
- if l__LocalPlayer__4.Character then
- if 0 < l__LocalPlayer__4.Character.Humanoid.Health then
- local v13 = l__mouse__5.Hit;
- if not u7 then
- if game:GetService("UserInputService").GamepadEnabled then
- local v14 = u3.MobileAim.AbsolutePosition;
- local v15 = u3.MobileAim.AbsoluteSize;
- if u2 then
- v14 = u3.Scope.AbsolutePosition;
- v15 = u3.Scope.AbsoluteSize;
- end;
- local l__Magnitude__16 = (l__LocalPlayer__4.Character.Head.Position - game.Workspace.CurrentCamera.CFrame.p).Magnitude;
- local v17 = game.Workspace.CurrentCamera:ScreenPointToRay(v14.X + v15.X / 2, v14.Y + v15.Y / 2, 0);
- local v18, v19 = game.Workspace:FindPartOnRay(Ray.new(v17.Origin, v17.Direction * 10000), l__LocalPlayer__4.Character);
- v13 = CFrame.new(v19);
- end;
- else
- v14 = u3.MobileAim.AbsolutePosition;
- v15 = u3.MobileAim.AbsoluteSize;
- if u2 then
- v14 = u3.Scope.AbsolutePosition;
- v15 = u3.Scope.AbsoluteSize;
- end;
- l__Magnitude__16 = (l__LocalPlayer__4.Character.Head.Position - game.Workspace.CurrentCamera.CFrame.p).Magnitude;
- v17 = game.Workspace.CurrentCamera:ScreenPointToRay(v14.X + v15.X / 2, v14.Y + v15.Y / 2, 0);
- v18, v19 = game.Workspace:FindPartOnRay(Ray.new(v17.Origin, v17.Direction * 10000), l__LocalPlayer__4.Character);
- v13 = CFrame.new(v19);
- end;
- local l__Position__20 = script.Parent.Parent.Head.Position;
- local l__lookVector__21 = CFrame.new(l__Position__20, v13.p).lookVector;
- l__Projectiles__12.ProjectileRenderEvent:FireServer(0, l__LocalPlayer__4.Name, 1, l__Position__20, v13, 70, 5000, "Squid");
- local u14 = 0;
- coroutine.wrap(function()
- local v22 = game.ReplicatedStorage.ProjectileSquid:Clone();
- v22.Parent = game.Workspace;
- local v23 = 0;
- local v24 = l__Position__20;
- local v25 = 2;
- while true do
- if v23 < 5000 then
- else
- break;
- end;
- local v26, v27 = game.Workspace:FindPartOnRay(Ray.new(v24, l__lookVector__21.unit * v25), game.Players.LocalPlayer.Character, true, true);
- v24 = v27;
- if not v26 then
- else
- local l__Body__28 = v26.Parent:FindFirstChild("Body");
- if l__Body__28 then
- l__Projectiles__12.HealthChange:FireServer(l__Body__28.Parent.OwnerName.Value, 80, u13);
- end;
- local l__Body__29 = v26.Parent.Parent:FindFirstChild("Body");
- if l__Body__29 then
- l__Projectiles__12.HealthChange:FireServer(l__Body__29.Parent.OwnerName.Value, 80, u13);
- end;
- l__Projectiles__12.ProjectileRenderEvent:FireServer(1, l__LocalPlayer__4.Name, 1, l__Position__20, v13, 70, 5000, "Squid", v26, u13);
- break;
- end;
- u14 = u14 + 5;
- v22.CFrame = CFrame.new(v24, v24 + l__lookVector__21) * CFrame.Angles(math.pi / 2, u14, 0);
- if v25 * 2 < 70 then
- v25 = v25 * 2;
- elseif v25 ~= 70 then
- v25 = 70;
- end;
- v23 = v23 + v25;
- end;
- v22:Destroy();
- end)();
- end;
- end;
- u10 = false;
- u9:Stop();
- end;
- end;
- end;
- end;
- local u15 = 0;
- function reload()
- if u11 then
- return;
- end;
- u15 = u15 + 1;
- u11 = true;
- u10 = false;
- script.Parent.Handle.ReloadSound:Play();
- if u15 ~= u15 then
- print("cancel reload");
- return;
- end;
- u4 = math.huge;
- u3.Frame.Ammo.Text = u4 .. " / " .. 5;
- u3.Frame.ReloadReminder.Visible = false;
- u11 = false;
- end;
- local u16 = nil;
- function ResetCamera()
- u16 = nil;
- script.Parent.Handle.Transparency = 0;
- l__CurrentCamera__6.CameraType = Enum.CameraType.Custom;
- l__CurrentCamera__6.CFrame = u5._CFrame;
- l__CurrentCamera__6.FieldOfView = u5.FieldOfView;
- l__UserInputService__6.MouseBehavior = u5.MouseBehavior;
- l__UserInputService__6.MouseDeltaSensitivity = u5.MouseDeltaSensitivity;
- if u3:FindFirstChild("Scope") then
- u3.Scope.Visible = false;
- end;
- end;
- local u17 = 0;
- local u18 = 0;
- local u19 = 0;
- local u20 = 0;
- local function u21()
- script.Parent.Handle.Transparency = 1;
- l__CurrentCamera__6.CameraType = Enum.CameraType.Scriptable;
- u5._CFrame = l__CurrentCamera__6.CFrame;
- u5.FieldOfView = l__CurrentCamera__6.FieldOfView;
- u5.MouseBehavior = l__UserInputService__6.MouseBehavior;
- u5.MouseDeltaSensitivity = l__UserInputService__6.MouseDeltaSensitivity;
- u16 = l__mouse__9.Hit.p;
- if l__UserInputService__6.TouchEnabled then
- local l__AbsolutePosition__30 = u3.MobileAim.AbsolutePosition;
- local l__AbsoluteSize__31 = u3.MobileAim.AbsoluteSize;
- local l__Magnitude__32 = (l__LocalPlayer__4.Character.Head.Position - game.Workspace.CurrentCamera.CFrame.p).Magnitude;
- local v33 = game.Workspace.CurrentCamera:ScreenPointToRay(l__AbsolutePosition__30.X + l__AbsoluteSize__31.X / 2, l__AbsolutePosition__30.Y + l__AbsoluteSize__31.Y / 2, 0);
- local v34, v35 = game.Workspace:FindPartOnRay(Ray.new(v33.Origin, v33.Direction * 10000), l__LocalPlayer__4.Character);
- u16 = v35;
- end;
- local v36 = CFrame.new(l__Head__8.Position, u16);
- l__CurrentCamera__6.CFrame = v36 + v36.LookVector * 3;
- l__CurrentCamera__6.Focus = CFrame.new(u16);
- l__CurrentCamera__6.FieldOfView = 8;
- l__UserInputService__6.MouseBehavior = Enum.MouseBehavior.LockCenter;
- l__UserInputService__6.MouseDeltaSensitivity = 1;
- u17 = 0;
- u18 = 0;
- u19 = 0;
- u20 = 0;
- u3.Scope.Visible = true;
- end;
- function zoomToggle()
- if u2 then
- ResetCamera();
- else
- u21();
- end;
- u2 = not u2;
- if u2 then
- coroutine.wrap(function()
- while true do
- if u2 then
- else
- break;
- end;
- moveCamera();
- l__RenderStepped__3:wait();
- end;
- end)();
- end;
- end;
- function getThumbsticks()
- local v37 = nil;
- local v38 = nil;
- local v39 = game:GetService("UserInputService"):GetGamepadState(Enum.UserInputType.Gamepad1);
- local v40 = #v39;
- local v41 = 1 - 1;
- while true do
- if v39[v41].KeyCode == Enum.KeyCode.Thumbstick1 then
- v37 = v41;
- elseif v39[v41].KeyCode == Enum.KeyCode.Thumbstick2 then
- v38 = v41;
- end;
- if 0 <= 1 then
- if v41 < v40 then
- else
- break;
- end;
- elseif v40 < v41 then
- else
- break;
- end;
- v41 = v41 + 1;
- end;
- return v37, v38;
- end;
- function getJoystickPositions()
- local v42, v43 = getThumbsticks();
- local v44 = l__UserInputService__6:GetGamepadState(Enum.UserInputType.Gamepad1);
- return v44[v42].Position, v44[v43].Position;
- end;
- function moveCamera()
- if u2 then
- if l__UserInputService__6.GamepadEnabled then
- local v45, v46 = getJoystickPositions();
- local v47 = Vector2.new(v46.x / 1.6, -v46.y / 1.6) * 0.2;
- else
- v47 = Vector2.new(0, 0);
- end;
- local v48 = u18 - v47.y;
- local v49 = u20 - v47.x;
- if 80 <= v48 then
- local v50 = 80;
- elseif v48 <= -80 then
- v50 = -80;
- else
- v50 = v48;
- end;
- u18 = v50;
- if 80 <= v49 then
- local v51 = 80;
- elseif v49 <= -80 then
- v51 = -80;
- else
- v51 = v49;
- end;
- u20 = v51;
- u17 = u17 + (u18 - u17) * 0.35;
- u19 = u19 + (u20 - u19) * 0.15;
- l__CurrentCamera__6.CFrame = CFrame.new(l__Head__8.Position, u16) * CFrame.Angles(0, math.rad(u19), 0) * CFrame.Angles(math.rad(u17), 0, 0);
- l__CurrentCamera__6.CFrame = l__CurrentCamera__6.CFrame + l__CurrentCamera__6.CFrame.LookVector * 3;
- end;
- end;
- local v52 = Vector2.new(0, math.rad(-60));
- local function u22(p2)
- if u2 then
- if l__UserInputService__6.GamepadEnabled then
- local v53 = Vector2.new(0, 0);
- else
- v53 = Vector2.new(p2.Delta.x / 0.8, p2.Delta.y / 0.8) * 0.05;
- end;
- local v54 = u18 - v53.y;
- local v55 = u20 - v53.x;
- if v54 >= 80 then
- local v56 = 80;
- elseif v54 <= -80 then
- v56 = -80;
- else
- v56 = v54;
- end;
- u18 = v56;
- if v55 >= 80 then
- local v57 = 80;
- elseif v55 <= -80 then
- v57 = -80;
- else
- v57 = v55;
- end;
- u20 = v57;
- u17 = u17 + (u18 - u17) * 0.35;
- u19 = u19 + (u20 - u19) * 0.15;
- l__CurrentCamera__6.CFrame = CFrame.new(l__Head__8.Position, u16) * CFrame.Angles(0, math.rad(u19), 0) * CFrame.Angles(math.rad(u17), 0, 0);
- l__CurrentCamera__6.CFrame = l__CurrentCamera__6.CFrame + l__CurrentCamera__6.CFrame.LookVector * 3;
- end;
- end;
- if not (not l__UserInputService__6.MouseEnabled) or not (not l__UserInputService__6.TouchEnabled) or l__UserInputService__6.GamepadEnabled then
- l__UserInputService__6.InputBegan:Connect(function(p3, p4)
- if u1 and p3.KeyCode == Enum.KeyCode.Z then
- zoomToggle();
- end;
- end);
- l__UserInputService__6.InputChanged:Connect(function(p5, p6)
- if u1 and (p5.UserInputType == Enum.UserInputType.MouseMovement or p5.UserInputType == Enum.UserInputType.Touch or p5.UserInputType == Enum.UserInputType.Gamepad1) then
- u22(p5);
- end;
- end);
- end;
- game.Workspace.Events.S.SEvent.OnClientEvent:connect(function(p7)
- u13 = p7;
- end);
Add Comment
Please, Sign In to add comment