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