R

silentAim = true

public
rrixh Jul 28, 2024 Never 54
Clone
Plaintext ZATK-silentAim_rrixh.xlsx 52 lines (51 loc) | 1.86 KB
1
Player = game.Players.LocalPlayer;
2
local function getNearestEnemies()
3
local nearest, dist = nil, 99999
4
for _, v in pairs(game.Workspace.BossFolder:GetChildren()) do
5
if v:FindFirstChild("Head") ~= nil then
6
local m = (Player.Character.Head.Position - v.Head.Position).magnitude
7
if m < dist then
8
dist = m
9
nearest = v
10
end;end;end;--find boss enemy
11
for _, v in pairs(game.Workspace.enemies:GetChildren()) do
12
if v:FindFirstChild("Head") ~= nil then
13
local m = (Player.Character.Head.Position - v.Head.Position).magnitude
14
if m < dist then
15
dist = m
16
nearest = v
17
end;end;end;--find normal enemy
18
return nearest;
19
end;
20
silentAim = true
21
Player.Chatted:Connect(function(m)
22
if m == "/unsh" then
23
silentAim = false
24
elseif m == "/sh" then
25
silentAim = true
26
end;
27
end)
28
--------------////--------------------
29
_G.globalTarget = nil
30
game:GetService("RunService").RenderStepped:Connect(function()
31
if silentAim == true then
32
local target = getNearestEnemies()
33
if target ~= nil then
34
_G.globalTarget = target
35
end
36
end
37
end)
38
39
while wait() do
40
if silentAim == true and _G.globalTarget ~= nil and _G.globalTarget:FindFirstChild("Head") and Player.Character:FindFirstChildOfClass("Tool") then
41
local target = _G.globalTarget
42
game.ReplicatedStorage.Gun:FireServer({
43
["Normal"] = Vector3.new(0, 0, 0),
44
["Direction"] = target.Head.Position,
45
["Name"] = Player.Character:FindFirstChildOfClass("Tool").Name,
46
["Hit"] = target.Head,
47
["Origin"] = target.Head.Position,
48
["Pos"] = target.Head.Position,
49
})
50
wait()
51
end
52
end