1 | |
2 | |
3 | _G.Reach = 12 |
4 | |
5 | _G.KeyBindHigher = "r" |
6 | _G.KeyBindLower = "e" |
7 | _G.KeyBindToggleReach = "t" |
8 | _G.KeyBindToggleHole = "j" |
9 | _G.KeyBindToggleSmartReach = "g" |
10 | |
11 | _G.ReachOff = false |
12 | _G.HoleOff = false |
13 | _G.SmartReachOff = false |
14 | |
15 | local dmgEnabled = true |
16 | |
17 | local function onHit(hit, handle) |
18 | local victim = hit.Parent:FindFirstChildOfClass("Humanoid") |
19 | if victim and victim.Parent.Name ~= game.Players.LocalPlayer.Name then |
20 | if dmgEnabled then |
21 | for _, v in pairs(hit.Parent:GetChildren()) do |
22 | if v:IsA("Part") then |
23 | firetouchinterest(v, handle, 0) |
24 | firetouchinterest(v, handle, 1) |
25 | end |
26 | end |
27 | else |
28 | firetouchinterest(hit, handle, 0) |
29 | firetouchinterest(hit, handle, 1) |
30 | end |
31 | end |
32 | end |
33 | |
34 | local function allPlayersHaveLowerHealth() |
35 | local myHumanoid = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid") |
36 | local myHealth = myHumanoid and myHumanoid.Health or 0 |
37 | |
38 | for _, v in pairs(game.Players:GetPlayers()) do |
39 | if v ~= game.Players.LocalPlayer then |
40 | local victimHumanoid = v.Character and v.Character:FindFirstChildOfClass("Humanoid") |
41 | local victimHealth = victimHumanoid and victimHumanoid.Health or 0 |
42 | if victimHealth >= myHealth then |
43 | return false |
44 | end |
45 | end |
46 | end |
47 | return true |
48 | end |
49 | |
50 | game:GetService("RunService").Stepped:Connect(function() |
51 | if _G.ReachOff then return end |
52 | |
53 | pcall(function() |
54 | local sword = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool").Handle |
55 | local hrp = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") |
56 | local myHumanoid = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid") |
57 | local myHealth = myHumanoid and myHumanoid.Health or 0 |
58 | |
59 | for _, v in pairs(game.Players:GetPlayers()) do |
60 | if v ~= game.Players.LocalPlayer and v.Character:FindFirstChild("Left Arm") then |
61 | local victimHumanoid = v.Character:FindFirstChildOfClass("Humanoid") |
62 | local victimHealth = victimHumanoid and victimHumanoid.Health or 0 |
63 | |
64 | local hitPos = v.Character:FindFirstChild("Left Arm").Position |
65 | local hrpPos = hrp.Position |
66 | local yOffset = -0.1 |
67 | |
68 | local isWithinReach = (game.Players.LocalPlayer.Character.Torso.Position - v.Character.Torso.Position).Magnitude <= _G.Reach |
69 | local isNotUnderCharacter = hitPos.Y >= hrpPos.Y + yOffset |
70 | |
71 | local isHealthConditionMet = not _G.SmartReachOff or (victimHealth >= myHealth and not allPlayersHaveLowerHealth()) |
72 | |
73 | if _G.HoleOff then |
74 | if isWithinReach and isNotUnderCharacter and (not _G.SmartReachOff or isHealthConditionMet) then |
75 | onHit(v.Character:FindFirstChild("Left Arm"), sword) |
76 | end |
77 | else |
78 | if isWithinReach and (not _G.SmartReachOff or isHealthConditionMet) then |
79 | onHit(v.Character:FindFirstChild("Left Arm"), sword) |
80 | end |
81 | end |
82 | end |
83 | end |
84 | end) |
85 | end) |
86 | |
87 | local Mouse = game.Players.LocalPlayer:GetMouse() |
88 | Mouse.KeyDown:Connect(function(key) |
89 | if key == _G.KeyBindHigher then |
90 | _G.Reach = _G.Reach + 1 |
91 | game.StarterGui:SetCore("SendNotification", { |
92 | Title = "Reach Adjustment"; |
93 | Text = "Increased to " .. _G.Reach; |
94 | }) |
95 | elseif key == _G.KeyBindLower then |
96 | _G.Reach = _G.Reach - 1 |
97 | game.StarterGui:SetCore("SendNotification", { |
98 | Title = "Reach Adjustment"; |
99 | Text = "Decreased to " .. _G.Reach; |
100 | }) |
101 | elseif key == _G.KeyBindToggleReach then |
102 | _G.ReachOff = not _G.ReachOff |
103 | game.StarterGui:SetCore("SendNotification", { |
104 | Title = _G.ReachOff and "Off" or "On"; |
105 | Text = "Reach"; |
106 | }) |
107 | elseif key == _G.KeyBindToggleHole then |
108 | _G.HoleOff = not _G.HoleOff |
109 | game.StarterGui:SetCore("SendNotification", { |
110 | Title = _G.HoleOff and "Off" or "On"; |
111 | Text = "Hole"; |
112 | }) |
113 | elseif key == _G.KeyBindToggleSmartReach then |
114 | _G.SmartReachOff = not _G.SmartReachOff |
115 | game.StarterGui:SetCore("SendNotification", { |
116 | Title = _G.SmartReachOff and "On" or "Off"; |
117 | Text = "Smart Reach"; |
118 | }) |
119 | end |
120 | end) |