0% found this document useful (0 votes)
151 views

Advanced Trigger Bot.lua

Uploaded by

deberrydelvin1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views

Advanced Trigger Bot.lua

Uploaded by

deberrydelvin1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

--[[

░█─── █▀▀ █▀▀█ █─█ █▀▀ █▀▀▄ █▀▀▄ █──█


░█─── █▀▀ █▄▄█ █▀▄ █▀▀ █──█ █▀▀▄ █▄▄█
░█▄▄█ ▀▀▀ ▀──▀ ▀─▀ ▀▀▀ ▀▀▀─ ▀▀▀─ ▄▄▄█
──▀ █▀▀█ █▀▄▀█ █─█ █── █▀▀ █▀▀
──█ █▄▄█ █─▀─█ █▀▄ █── █▀▀ ▀▀█
█▄█ ▀──▀ ▀───▀ ▀─▀ ▀▀▀ ▀▀▀ ▀▀▀

]]

--> Services | Variables <--


local Workspace = Game:GetService("Workspace")
local RunService = Game:GetService("RunService")
local Players = Game:GetService("Players")
local VirtualInputManager = Game:GetService("VirtualInputManager")
local StarterGui = Game:GetService("StarterGui")

--> LocalPlayer | Variables <--


local player = Players.LocalPlayer
local playerCamera = Workspace.CurrentCamera

--> TargetedPlayer | Variables <--


local TargetedPlayer = nil

--> Script | Global Table <--

getgenv().Script = {
TriggerBot = {
Enabled = true,
ClickDelay = 0,
},
FOV = {
Circle = {
Visible = true,
Color = Color3.fromRGB(255, 255, 255),
Transparency = 1,
Thickness = 1.5,
NumSides = 1000000,
Radius = 20,
Filled = false,
},
}
}

--> FOV Circle | Drawing <--


local FOVCircle = Drawing.new("Circle")
FOVCircle.Visible = Script.FOV.Circle.Visible
FOVCircle.Color = Script.FOV.Circle.Color
FOVCircle.Transparency = Script.FOV.Circle.Transparency
FOVCircle.Thickness = Script.FOV.Circle.Thickness
FOVCircle.NumSides = Script.FOV.Circle.NumSides
FOVCircle.Radius = Script.FOV.Circle.Radius
FOVCircle.Filled = Script.FOV.Circle.Filled
FOVCircle.Position = Vector2.new(playerCamera.ViewportSize.X / 2,
playerCamera.ViewportSize.Y / 2)

--> Wall Check | Function <--


local function WallCheck(Part)
local Direction = (Part.Position - playerCamera.CFrame.Position).Unit *
(Part.Position - playerCamera.CFrame.Position).Magnitude
local NewRay = Ray.new(playerCamera.CFrame.Position, Direction)
local Hit, Position = Workspace:FindPartOnRay(NewRay, playerCharacter, false,
true)

if Hit and Hit:IsDescendantOf(Part.Parent) and Part.Parent:IsA("Model") then


return true
end
return false
end

--> Get Closest Player | Function <--


local function GetClosestPlayer()
local ClosestPlayer = nil
local ShortestDistance = math.huge

for _, Player in ipairs(Players:GetPlayers()) do


if Player ~= player and Player.Character then
for _, PlayerPart in ipairs(Player.Character:GetChildren()) do
if PlayerPart:IsA("BasePart") and PlayerPart.Transparency ~= 1 and
WallCheck(PlayerPart) then
local ViewportPointPosition, OnScreen =
playerCamera:WorldToViewportPoint(PlayerPart.Position)

if OnScreen then
local MagnitudeDistance =
(Vector2.new(ViewportPointPosition.X, ViewportPointPosition.Y) -
FOVCircle.Position).Magnitude

if (MagnitudeDistance < ShortestDistance) and


MagnitudeDistance < FOVCircle.Radius then
ClosestPlayer = Player
ShortestDistance = MagnitudeDistance
end
end
end
end
end
end
return ClosestPlayer
end

--> Trigger Bot | RenderStepped Function <--


RunService.RenderStepped:Connect(function()
TargetedPlayer = GetClosestPlayer()
if Script.TriggerBot.Enabled and TargetedPlayer and TargetedPlayer.Character
and TargetedPlayer.Character:FindFirstChildOfClass("Humanoid").Health ~= 0 then
task.wait(Script.TriggerBot.ClickDelay)
for Index, BodyPart in ipairs(TargetedPlayer.Character:GetChildren()) do
if BodyPart.Name == "Head" or
BodyPart.Name == "UpperTorso" or
BodyPart.Name == "LowerTorso" or
BodyPart.Name == "LeftUpperArm" or
BodyPart.Name == "LeftLowerArm" or
BodyPart.Name == "LeftHand" or
BodyPart.Name == "RightUpperArm" or
BodyPart.Name == "RightLowerArm" or
BodyPart.Name == "RightHand" or
BodyPart.Name == "LeftUpperLeg" or
BodyPart.Name == "LeftLowerLeg" or
BodyPart.Name == "LeftFoot" or
BodyPart.Name == "RightUpperLeg" or
BodyPart.Name == "RightLowerLeg" or
BodyPart.Name == "RightFoot" then
local ViewportPointPosition, OnScreen =
playerCamera:WorldToViewportPoint(BodyPart.Position)
if OnScreen then
local MagnitudeDistance = (Vector2.new(ViewportPointPosition.X,
ViewportPointPosition.Y) - FOVCircle.Position).Magnitude
if MagnitudeDistance <= FOVCircle.Radius then

VirtualInputManager:SendMouseButtonEvent(playerCamera.ViewportSize.X/2,
playerCamera.ViewportSize.Y/2, 0, true, Game, 0)
end
end
end
end
end
end)

--> Trigger Bot | RenderStepped Function <--


RunService.RenderStepped:Connect(function()
TargetedPlayer = GetClosestPlayer()
if Script.TriggerBot.Enabled and TargetedPlayer then
task.wait(Script.TriggerBot.ClickDelay)
VirtualInputManager:SendMouseButtonEvent(playerCamera.ViewportSize.X/2,
playerCamera.ViewportSize.Y/2, 0, true, Game, 0)
end
end)

You might also like