local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local VirtualInputManager = game:GetService("VirtualInputManager")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local TRIGGERBOT_KEY = Enum.KeyCode.T
local TRIGGERBOT_ENABLED = false
local HOLDING = false
local gui = Instance.new("ScreenGui")
gui.Name = "TriggerBotHUD"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.Parent = player:WaitForChild("PlayerGui")
local dot = Instance.new("Frame")
dot.Size = UDim2.new(0, 5, 0, 5)
dot.Position = UDim2.new(0, 10, 0, 10)
dot.AnchorPoint = Vector2.new(0, 0)
dot.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
dot.Visible = false
dot.BorderSizePixel = 0
dot.Name = "Dot"
dot.Parent = gui
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(1, 0)
corner.Parent = dot
local function showDot(color)
dot.BackgroundColor3 = color
dot.Visible = true
task.delay(0.1, function()
dot.Visible = false
end)
end
UserInputService.InputBegan:Connect(function(input, gp)
if gp then return end
if input.KeyCode == TRIGGERBOT_KEY then
TRIGGERBOT_ENABLED = not TRIGGERBOT_ENABLED
if TRIGGERBOT_ENABLED then
showDot(Color3.fromRGB(0, 255, 0))
else
showDot(Color3.fromRGB(255, 0, 0))
if HOLDING then
local mousePos = UserInputService:GetMouseLocation()
VirtualInputManager:SendMouseButtonEvent(mousePos.X, mousePos.Y, 0, false, game, 0)
HOLDING = false
end
end
end
end)
local function isCharacter(model)
return model and model:FindFirstChildOfClass("Humanoid")
end
local IGNORE_NAMES = {
["lightbouncer"] = true,
["building rail"] = true,
["glass"] = true,
["clip"] = true,
["raycast"] = true,
["ignore"] = true,
["lightbounce"] = true
}
local function raycastThroughIgnored(origin, direction, maxDistance)
local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {player.Character}
rayParams.FilterType = Enum.RaycastFilterType.Blacklist
local traveled = 0
local stepOrigin = origin
local remaining = direction.Unit * maxDistance
while traveled < maxDistance do
local result = workspace:Raycast(stepOrigin, remaining, rayParams)
if not result then
return nil
end
local hitPart = result.Instance
if hitPart then
local name = hitPart.Name:lower()
if IGNORE_NAMES[name] then
stepOrigin = result.Position + (direction.Unit * 0.01)
traveled = (stepOrigin - origin).Magnitude
else
return result
end
else
return nil
end
end
return nil
end
local function getTarget()
local mousePos = UserInputService:GetMouseLocation()
local ray = camera:ViewportPointToRay(mousePos.X, mousePos.Y)
local result = raycastThroughIgnored(ray.Origin, ray.Direction, 1000)
if result then
local model = result.Instance:FindFirstAncestorOfClass("Model")
if isCharacter(model) and model ~= player.Character then
local targetPlayer = Players:GetPlayerFromCharacter(model)
if not targetPlayer then return true end -- FFA
local playerTeam = player.Team
local targetTeam = targetPlayer.Team
if not playerTeam or not targetTeam then return true end -- FFA
if targetTeam ~= playerTeam then return true end
end
end
return false
end
RunService.RenderStepped:Connect(function()
if TRIGGERBOT_ENABLED then
local target = getTarget()
local mousePos = UserInputService:GetMouseLocation()
if target and not HOLDING then
VirtualInputManager:SendMouseButtonEvent(mousePos.X, mousePos.Y, 0, true, game, 0)
HOLDING = true
elseif not target and HOLDING then
VirtualInputManager:SendMouseButtonEvent(mousePos.X, mousePos.Y, 0, false, game, 0)
HOLDING = false
end
end
end)
Comments
No comments yet
Be the first to share your thoughts!