Roblox Reach Player Target (ignores players under you)

public
vxpreen Apr 02, 2024 Never 83
Clone
Lua paste1.lua 316 lines (291 loc) | 11.9 KB
1
-- loadstring(game:HttpGet("https://pastecode.dev/raw/f6vmqxxx/paste1.lua"))() or
2
3
local active = true
4
local trueActive = true
5
local reachType = "Sphere"
6
local target = "Others" -- Default target
7
local visualizerEnabled = false
8
9
local visualizer = Instance.new("Part")
10
visualizer.BrickColor = BrickColor.Blue()
11
visualizer.Transparency = 0.6
12
visualizer.Anchored = true
13
visualizer.CanCollide = false
14
visualizer.Size = Vector3.new(0.5,0.5,0.5)
15
visualizer.BottomSurface = Enum.SurfaceType.Smooth
16
visualizer.TopSurface = Enum.SurfaceType.Smooth
17
18
local ScreenGui = Instance.new("ScreenGui")
19
local Frame = Instance.new("Frame")
20
local TextLabel = Instance.new("TextLabel")
21
local TextBox = Instance.new("TextBox")
22
local TextLabel_2 = Instance.new("TextLabel")
23
local TextLabel_3 = Instance.new("TextLabel")
24
local TextLabel_4 = Instance.new("TextLabel")
25
local TextButton = Instance.new("TextButton")
26
local Frame_2 = Instance.new("Frame")
27
local Frame_3 = Instance.new("Frame")
28
local Frame_4 = Instance.new("Frame")
29
local Frame_5 = Instance.new("Frame")
30
local TextButton_2 = Instance.new("TextButton")
31
32
--Properties:
33
34
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
35
ScreenGui.DisplayOrder = 999999999
36
ScreenGui.ResetOnSpawn = false
37
38
Frame.Parent = ScreenGui
39
Frame.AnchorPoint = Vector2.new(0, 0.5)
40
Frame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
41
Frame.BackgroundTransparency = 0.300
42
Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
43
Frame.BorderSizePixel = 4
44
Frame.Position = UDim2.new(0, 0, 0.600000024, 0)
45
Frame.Size = UDim2.new(0.150000006, 0, 0.300000012, 0)
46
47
TextLabel.Parent = Frame
48
TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
49
TextLabel.BackgroundTransparency = 1.000
50
TextLabel.Size = UDim2.new(0.600000024, 0, 0.200000003, 0)
51
TextLabel.Font = Enum.Font.SourceSans
52
TextLabel.Text = "Reach:"
53
TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
54
TextLabel.TextScaled = true
55
TextLabel.TextSize = 14.000
56
TextLabel.TextWrapped = true
57
58
TextBox.Parent = Frame
59
TextBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
60
TextBox.BackgroundTransparency = 1.000
61
TextBox.Position = UDim2.new(0.600000024, 0, 0, 0)
62
TextBox.Size = UDim2.new(0.400000006, 0, 0.200000003, 0)
63
TextBox.Font = Enum.Font.SourceSans
64
TextBox.Text = "3.5"
65
TextBox.TextColor3 = Color3.fromRGB(255, 76, 76)
66
TextBox.TextScaled = true
67
TextBox.TextSize = 14.000
68
TextBox.TextWrapped = true
69
70
TextLabel_2.Parent = Frame
71
TextLabel_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
72
TextLabel_2.BackgroundTransparency = 1.000
73
TextLabel_2.Position = UDim2.new(0, 0, 0.200000003, 0)
74
TextLabel_2.Size = UDim2.new(0.600000024, 0, 0.200000003, 0)
75
TextLabel_2.Font = Enum.Font.SourceSans
76
TextLabel_2.Text = "Shape:"
77
TextLabel_2.TextColor3 = Color3.fromRGB(255, 255, 255)
78
TextLabel_2.TextScaled = true
79
TextLabel_2.TextSize = 14.000
80
TextLabel_2.TextWrapped = true
81
82
TextLabel_3.Parent = Frame
83
TextLabel_3.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
84
TextLabel_3.BackgroundTransparency = 1.000
85
TextLabel_3.Position = UDim2.new(0, 0, 0.400000006, 0)
86
TextLabel_3.Size = UDim2.new(0.600000024, 0, 0.200000003, 0)
87
TextLabel_3.Font = Enum.Font.SourceSans
88
TextLabel_3.Text = "Target:"
89
TextLabel_3.TextColor3 = Color3.fromRGB(255, 255, 255)
90
TextLabel_3.TextScaled = true
91
TextLabel_3.TextSize = 14.000
92
TextLabel_3.TextWrapped = true
93
94
TextLabel_4.Parent = Frame
95
TextLabel_4.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
96
TextLabel_4.BackgroundTransparency = 1.000
97
TextLabel_4.Position = UDim2.new(0, 0, 0.600000024, 0)
98
TextLabel_4.Size = UDim2.new(0.600000024, 0, 0.200000003, 0)
99
TextLabel_4.Font = Enum.Font.SourceSans
100
TextLabel_4.Text = "Visualizer:"
101
TextLabel_4.TextColor3 = Color3.fromRGB(255, 255, 255)
102
TextLabel_4.TextScaled = true
103
TextLabel_4.TextSize = 14.000
104
TextLabel_4.TextWrapped = true
105
106
TextButton.Parent = Frame
107
TextButton.AnchorPoint = Vector2.new(0, 1)
108
TextButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
109
TextButton.BackgroundTransparency = 1.000
110
TextButton.Position = UDim2.new(0, 0, 1, 0)
111
TextButton.Size = UDim2.new(1, 0, 0.150000006, 0)
112
TextButton.Font = Enum.Font.SourceSansBold
113
TextButton.Text = "Kill Script"
114
TextButton.TextColor3 = Color3.fromRGB(222, 0, 0)
115
TextButton.TextScaled = true
116
TextButton.TextSize = 14.000
117
TextButton.TextWrapped = true
118
119
Frame_2.Parent = Frame
120
Frame_2.Active = true
121
Frame_2.AnchorPoint = Vector2.new(0, 0.5)
122
Frame_2.BackgroundColor3 = Color3.fromRGB(31, 31, 31)
123
Frame_2.BorderSizePixel = 0
124
Frame_2.Position = UDim2.new(0.725000024, 0, 0.699999988, 0)
125
Frame_2.Size = UDim2.new(0, 25, 0, 25)
126
Frame_2.ZIndex = 5
127
128
Frame_3.Parent = Frame_2
129
Frame_3.AnchorPoint = Vector2.new(0.5, 0.5)
130
Frame_3.BackgroundColor3 = Color3.fromRGB(255, 76, 76)
131
Frame_3.BorderSizePixel = 0
132
Frame_3.LayoutOrder = 1
133
Frame_3.Position = UDim2.new(0.5, 0, 0.5, 0)
134
135
Frame_4.Parent = Frame
136
Frame_4.Active = true
137
Frame_4.AnchorPoint = Vector2.new(0, 0.5)
138
Frame_4.BackgroundColor3 = Color3.fromRGB(31, 31, 31)
139
Frame_4.BorderSizePixel = 0
140
Frame_4.Position = UDim2.new(9999999, 99999999, 9999, 999999)
141
Frame_4.Size = UDim2.new(0, 25, 0, 25)
142
Frame_4.ZIndex = 5
143
144
Frame_5.Parent = Frame_4
145
Frame_5.AnchorPoint = Vector2.new(0.5, 0.5)
146
Frame_5.BackgroundColor3 = Color3.fromRGB(255, 76, 76)
147
Frame_5.BorderSizePixel = 0
148
Frame_5.LayoutOrder = 1
149
Frame_5.Position = UDim2.new(0.5, 0, 0.5, 0)
150
Frame_5.Size = UDim2.new(1, 0, 1, 0)
151
152
TextButton_2.Parent = Frame
153
TextButton_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
154
TextButton_2.BackgroundTransparency = 1.000
155
TextButton_2.Position = UDim2.new(0.600000024, 0, 0.200000003, 0)
156
TextButton_2.Size = UDim2.new(0.400000006, 0, 0.200000003, 0)
157
TextButton_2.Font = Enum.Font.SourceSans
158
TextButton_2.Text = "Sphere"
159
TextButton_2.TextColor3 = Color3.fromRGB(255, 76, 76)
160
TextButton_2.TextScaled = true
161
TextButton_2.TextSize = 14.000
162
TextButton_2.TextWrapped = true
163
164
-- Add a TextBox for Target input
165
local TargetTextBox = Instance.new("TextBox")
166
TargetTextBox.Parent = Frame
167
TargetTextBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
168
TargetTextBox.BackgroundTransparency = 1.000
169
TargetTextBox.Position = UDim2.new(0.600000024, 0, 0.400000006, 0)
170
TargetTextBox.Size = UDim2.new(0.400000006, 0, 0.200000003, 0)
171
TargetTextBox.Font = Enum.Font.SourceSans
172
TargetTextBox.Text = "Others" -- Default text
173
TargetTextBox.TextColor3 = Color3.fromRGB(255, 76, 76)
174
TargetTextBox.TextScaled = true
175
TargetTextBox.TextSize = 14.000
176
TargetTextBox.TextWrapped = true
177
178
-- Modify the TargetTextBox.FocusLost event to handle target selection
179
TargetTextBox.FocusLost:Connect(function(enterPressed)
180
local input = TargetTextBox.Text
181
if input:lower() == "others" then
182
target = "Others"
183
else
184
-- Check if the input matches any player's name partially or fully
185
for _, player in pairs(game.Players:GetPlayers()) do
186
if input:lower() == "others" or player.Name:lower():find(input:lower(), 1, true) then
187
target = player.Name
188
break
189
end
190
end
191
end
192
end)
193
194
-- Update the onHit function to consider the specified target and player positions relative to your character's position
195
local function onHit(hit, handle)
196
local victim = hit.Parent:FindFirstChildOfClass("Humanoid")
197
if victim then
198
if target == "Others" or (victim.Parent.Name == target and victim.Parent.Name ~= game.Players.LocalPlayer.Name) then
199
-- Get the position of your character's HumanoidRootPart
200
local hrp = game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
201
if hrp then
202
-- Check if the hit part is above your character's HumanoidRootPart
203
local hitPos = hit.Position
204
local hrpPos = hrp.Position
205
local yOffset = -0.1 -- Adjust this value as needed to avoid hitting players directly below you
206
if hitPos.Y >= hrpPos.Y + yOffset then
207
-- Interact only if the hit part is above your character
208
for _, v in pairs(hit.Parent:GetChildren()) do
209
if v:IsA("Part") then
210
firetouchinterest(v, handle, 0)
211
firetouchinterest(v, handle, 1)
212
end
213
end
214
end
215
end
216
end
217
end
218
end
219
220
repeat wait() until game.Players.LocalPlayer
221
ScreenGui.Parent = game:GetService("CoreGui")
222
223
Frame_4.InputBegan:connect(function(inp)
224
if inp.UserInputType == Enum.UserInputType.MouseButton1 then
225
visualizerEnabled = not visualizerEnabled
226
local goal = {Size = UDim2.new(0,0,0,0)}
227
if visualizerEnabled then
228
goal = {Size = UDim2.new(1,0,1,0)}
229
end
230
game:GetService("TweenService"):Create(Frame_3,TweenInfo.new(0.12,Enum.EasingStyle.Linear),goal):Play()
231
end
232
end)
233
TextButton_2.MouseButton1Click:connect(function()
234
if reachType == "Sphere" then
235
reachType = "Line"
236
else
237
reachType = "Sphere"
238
end
239
TextButton_2.Text = reachType
240
end)
241
TextButton.MouseButton1Click:connect(function()
242
trueActive = false
243
ScreenGui:Destroy()
244
end)
245
game:GetService("UserInputService").InputBegan:connect(function(inp,gpe)
246
if gpe then return end
247
if inp.KeyCode == Enum.KeyCode.H then
248
ScreenGui.Enabled = not ScreenGui.Enabled
249
end
250
end)
251
252
local plr = game.Players.LocalPlayer
253
254
local function getWhiteList()
255
local wl = {}
256
for _,v in pairs(game.Players:GetPlayers()) do
257
if v ~= plr then
258
local char = v.Character
259
if char then
260
for _,q in pairs(char:GetChildren()) do
261
if q:IsA("Part") then
262
table.insert(wl,q)
263
end
264
end
265
end
266
end
267
end
268
return wl
269
end
270
271
game:GetService("RunService").RenderStepped:connect(function()
272
if not active or not trueActive then return end
273
local s = plr.Character and plr.Character:FindFirstChildOfClass("Tool")
274
if not s then visualizer.Parent = nil end
275
if s then
276
local handle = s:FindFirstChild("Handle") or s:FindFirstChildOfClass("Part")
277
if handle then
278
if visualizerEnabled then
279
visualizer.Parent = workspace
280
else
281
visualizer.Parent = nil
282
end
283
local reach = tonumber(TextBox.Text)
284
if reach then
285
if reachType == "Sphere" then
286
visualizer.Shape = Enum.PartType.Ball
287
visualizer.Size = Vector3.new(reach,reach,reach)
288
visualizer.CFrame = handle.CFrame
289
for _,v in pairs(game.Players:GetPlayers()) do
290
local hrp = v.Character and v.Character:FindFirstChild("HumanoidRootPart")
291
if hrp and handle then
292
local mag = (hrp.Position-handle.Position).magnitude
293
if mag <= reach then
294
onHit(hrp,handle)
295
end
296
end
297
end
298
elseif reachType == "Line" then
299
local origin = (handle.CFrame*CFrame.new(0,0,-2)).p
300
local ray = Ray.new(origin,handle.CFrame.lookVector*-reach)
301
local p,pos = workspace:FindPartOnRayWithWhitelist(ray,getWhiteList())
302
visualizer.Shape = Enum.PartType.Block
303
visualizer.Size = Vector3.new(1,0.8,reach)
304
visualizer.CFrame = handle.CFrame*CFrame.new(0,0,(reach/2)+2)
305
if p then
306
onHit(p,handle)
307
else
308
for _,v in pairs(handle:GetTouchingParts()) do
309
onHit(v,handle)
310
end
311
end
312
end
313
end
314
end
315
end
316
end)