Roblox Reach Player Target

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