KEMBAR78
Text | PDF | Computing | Software
0% found this document useful (0 votes)
7 views16 pages

Text

The document is a Lua script for a game that manages a triggerbot feature, allowing certain authorized players to use it. It includes user authentication, configuration saving/loading, and GUI creation for user interaction. The script also provides functionality for draggable GUI elements and visual enhancements like corners, strokes, and gradients.

Uploaded by

8bxnk2gcs8
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)
7 views16 pages

Text

The document is a Lua script for a game that manages a triggerbot feature, allowing certain authorized players to use it. It includes user authentication, configuration saving/loading, and GUI creation for user interaction. The script also provides functionality for draggable GUI elements and visual enhancements like corners, strokes, and gradients.

Uploaded by

8bxnk2gcs8
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/ 16

local Players = game:GetService("Players")

local player = Players.LocalPlayer


local camera = workspace.CurrentCamera
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local VirtualUser = game:GetService("VirtualUser")
local HttpService = game:GetService("HttpService")

local authorizedUsers = {
["hxuntedyua"] = true,
["foundpeaceinmusic"] = true,
["971lk"] = true,
["jamarrocknm"] = true,
["nv15yo"] = true,
["haz_nt7"] = true,
["dahoodianprololss"] = true,
["claxifu"] = true,
["fortnitepro123yu"] = true,
["geuchsibsjcjjc"] = true,
["realestthug0"] = true,
["uhhhhhhhssjsoiehrfosf"] = true,
["itzmejeyden"] = true,
["xxic3pow3rblad3xx"] = true,
["greatyosif"] = true,
["xavi123123123"] = true,
["kaiontopong"] = true,
["divinexelias"] = true,
["vamp_x10"] = true,
["mm2_ho12"] = true,
["silly_haya00"] = true,
["imy_yourworst"] = true,
["scarsxgrave"] = true,
["azuer11112"] = true,
["60kftstez"] = true,
["rizz_king116"] = true,
["qw24rtyuis"] = true,
["xavi123123123"] = true,
["leo918288"] = true,
["yksvinebh"] = true,
["laisam1197"] = true,
["dahoodianproLOLSS"] = true,
["lilr0nni3"] = true,
["hangehavxn"] = true,
["fatamrao"] = true,
["babyjdubanddee"] = true,
["vammmpeeedddkizzz"] = true,
["007jsn"] = true,
["007jsnn"] = true,
["yakikrunsu"] = true,
["user41"] = true,
["user42"] = true,
["user43"] = true,
["user44"] = true,
["user45"] = true,
["user46"] = true,
["user47"] = true,
["user48"] = true,
["user49"] = true,
["user50"] = true,
["user51"] = true,
["user52"] = true,
["user53"] = true,
["user54"] = true,
["user55"] = true,
["user56"] = true,
["user57"] = true,
["user58"] = true,
["user59"] = true,
["user60"] = true,
["user61"] = true,
["user62"] = true,
["user63"] = true,
["user64"] = true,
["user65"] = true,
["user66"] = true,
["user67"] = true,
["user68"] = true,
["user69"] = true,
["user70"] = true,
["user71"] = true,
["user72"] = true,
["user73"] = true,
["user74"] = true,
["user75"] = true,
["user76"] = true,
["user77"] = true,
["user78"] = true,
["user79"] = true,
["user80"] = true,
["user81"] = true,
["user82"] = true,
["user83"] = true,
["user84"] = true,
["user85"] = true,
["user86"] = true,
["user87"] = true,
["user88"] = true,
["user89"] = true,
["user90"] = true,
["user91"] = true,
["user92"] = true,
["user93"] = true,
["user94"] = true,
["user95"] = true,
["user96"] = true,
["user97"] = true,
["user98"] = true,
["user99"] = true,
["user100"] = true
}

if not authorizedUsers[string.lower(player.Name)] then


warn("Unauthorized user: " .. player.Name)
player:Kick("You are not authorized to use this script.")
return
end

local dataFolder = player:WaitForChild("PlayerGui",


30):FindFirstChild("TriggerbotData")
if not dataFolder then
dataFolder = Instance.new("Folder")
dataFolder.Name = "TriggerbotData"
dataFolder.Parent = player.PlayerGui
end

local function saveConfig(config)


local success, json = pcall(HttpService.JSONEncode, HttpService, config)
if success then
local savedValue = dataFolder:FindFirstChild("ConfigJson") or
Instance.new("StringValue")
savedValue.Name = "ConfigJson"
savedValue.Parent = dataFolder
savedValue.Value = json
else
warn("Failed to encode config: " .. tostring(json))
end
end

local function loadConfig()


local savedValue = dataFolder:FindFirstChild("ConfigJson")
if savedValue and savedValue.Value ~= "" then
local success, decoded = pcall(HttpService.JSONDecode, HttpService,
savedValue.Value)
if success and type(decoded) == "table" then
return decoded
else
warn("Failed to decode config: " .. tostring(decoded))
end
end
return nil
end

local TriggerbotConfig = {
Enabled = false,
Delay = 0.03,
Prediction = 0,
Keybind = "T",
HitboxEnabled = false,
HitboxSize = 15,
HitboxTransparency = 0.9
}

local savedConfig = loadConfig()


if savedConfig then
for k, v in pairs(savedConfig) do
if TriggerbotConfig[k] ~= nil and typeof(v) == typeof(TriggerbotConfig[k])
then
TriggerbotConfig[k] = v
end
end
end

local function makeDraggable(guiObject)


local dragging, dragInput, dragStart, startPos
guiObject.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or
input.UserInputType == Enum.UserInputType.Touch then
dragging = true
dragStart = input.Position
startPos = guiObject.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)
guiObject.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or
input.UserInputType == Enum.UserInputType.Touch then
dragInput = input
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == dragInput and dragging then
local delta = input.Position - dragStart
guiObject.Position = UDim2.new(
startPos.X.Scale,
startPos.X.Offset + delta.X,
startPos.Y.Scale,
startPos.Y.Offset + delta.Y
)
end
end)
end

local function addCorner(instance, radius)


local success, corner = pcall(function()
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, radius)
c.Parent = instance
return c
end)
if not success then
warn("Failed to add UICorner to " .. instance.Name)
end
end

local function addStroke(instance, color, thickness)


local success, stroke = pcall(function()
local s = Instance.new("UIStroke")
s.Color = color
s.Thickness = thickness or 2
s.Transparency = 0.3
s.Parent = instance
return s
end)
if not success then
warn("Failed to add UIStroke to " .. instance.Name)
end
end

local function addGradient(instance)


local success, gradient = pcall(function()
local g = Instance.new("UIGradient")
g.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(30, 30, 30)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 100, 200))
})
g.Rotation = 45
g.Parent = instance
return g
end)
if not success then
warn("Failed to add UIGradient to " .. instance.Name)
end
end

local gui = Instance.new("ScreenGui")


gui.Name = "TriggerbotGUI"
gui.ResetOnSpawn = false
local success, err = pcall(function()
gui.Parent = player:WaitForChild("PlayerGui", 30)
print("ScreenGui parented to PlayerGui")
end)
if not success then
warn("Failed to parent ScreenGui: " .. tostring(err))
return
end

local toggleBtn
local success, err = pcall(function()
toggleBtn = Instance.new("ImageButton", gui)
toggleBtn.Size = UDim2.new(0, 200, 0, 200)
toggleBtn.Position = UDim2.new(0.05, 0, 0.4, 0)
toggleBtn.BackgroundTransparency = 1
toggleBtn.Image = "rbxthumb://type=Asset&id=111603509355959&w=420&h=420"
toggleBtn.ClipsDescendants = true
game:GetService("ContentProvider"):PreloadAsync({toggleBtn.Image})
print("Preloaded XShot logo")
addCorner(toggleBtn, 12)
makeDraggable(toggleBtn)
local hitboxFrame = Instance.new("Frame", toggleBtn)
hitboxFrame.Size = UDim2.new(0.8, 0, 0.8, 0)
hitboxFrame.Position = UDim2.new(0.1, 0, 0.1, 0)
hitboxFrame.BackgroundTransparency = 1
hitboxFrame.ClipsDescendants = true
print("ImageButton with XShot logo created")
end)
if not success then
warn("Failed to create ImageButton: " .. tostring(err))
return
end

local settingsFrame = Instance.new("Frame", gui)


settingsFrame.Size = UDim2.new(0, 400, 0, 220)
settingsFrame.Position = UDim2.new(0.05, 0, 0.55, 0)
settingsFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
settingsFrame.BackgroundTransparency = 0.2
settingsFrame.Visible = false
settingsFrame.ZIndex = 1
addCorner(settingsFrame, 10)
addGradient(settingsFrame)
addStroke(settingsFrame, Color3.fromRGB(0, 170, 255), 3)
makeDraggable(settingsFrame)
local row1Frame = Instance.new("Frame", settingsFrame)
row1Frame.Size = UDim2.new(0, 190, 0, 183)
row1Frame.Position = UDim2.new(0, 5, 0, 5)
row1Frame.BackgroundTransparency = 1
row1Frame.ZIndex = 2
local row1Layout = Instance.new("UIListLayout", row1Frame)
row1Layout.SortOrder = Enum.SortOrder.LayoutOrder
row1Layout.Padding = UDim.new(0, 2.5)

local row2Frame = Instance.new("Frame", settingsFrame)


row2Frame.Size = UDim2.new(0, 190, 0, 159)
row2Frame.Position = UDim2.new(0, 205, 0, 5)
row2Frame.BackgroundTransparency = 1
row2Frame.ZIndex = 2
local row2Layout = Instance.new("UIListLayout", row2Frame)
row2Layout.SortOrder = Enum.SortOrder.LayoutOrder
row2Layout.Padding = UDim.new(0, 2.5)

local enableToggle = Instance.new("TextButton", row1Frame)


enableToggle.Size = UDim2.new(0, 190, 0, 31)
enableToggle.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
enableToggle.TextColor3 = Color3.new(1, 1, 1)
enableToggle.Text = TriggerbotConfig.Enabled and "Enabled" or "Disabled"
enableToggle.Font = Enum.Font.GothamBlack
enableToggle.TextSize = 17
enableToggle.LayoutOrder = 1
addCorner(enableToggle, 8)
addStroke(enableToggle, Color3.fromRGB(0, 170, 255), 2)

enableToggle.MouseEnter:Connect(function()
pcall(function()
enableToggle.BackgroundColor3 = Color3.fromRGB(0, 200, 255)
end)
end)
enableToggle.MouseLeave:Connect(function()
pcall(function()
enableToggle.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
end)
end)

local delayLabel = Instance.new("TextLabel", row1Frame)


delayLabel.Size = UDim2.new(0, 190, 0, 17)
delayLabel.BackgroundTransparency = 1
delayLabel.Text = "Delay:"
delayLabel.TextColor3 = Color3.fromRGB(0, 170, 255)
delayLabel.Font = Enum.Font.GothamBlack
delayLabel.TextSize = 17
delayLabel.TextXAlignment = Enum.TextXAlignment.Left
delayLabel.LayoutOrder = 2

local delayBox = Instance.new("TextBox", row1Frame)


delayBox.Size = UDim2.new(0, 190, 0, 31)
delayBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
delayBox.TextColor3 = Color3.new(1, 1, 1)
delayBox.PlaceholderText = "Enter Delay"
delayBox.PlaceholderColor3 = Color3.fromRGB(100, 200, 255)
delayBox.Text = savedConfig and savedConfig.Delay and tostring(savedConfig.Delay)
or ""
delayBox.Font = Enum.Font.GothamBlack
delayBox.TextSize = 17
delayBox.ClearTextOnFocus = false
delayBox.LayoutOrder = 3
addCorner(delayBox, 8)
addStroke(delayBox, Color3.fromRGB(0, 170, 255), 2)

delayBox.MouseEnter:Connect(function()
pcall(function()
delayBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
end)
delayBox.MouseLeave:Connect(function()
pcall(function()
delayBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
end)

local predLabel = Instance.new("TextLabel", row1Frame)


predLabel.Size = UDim2.new(0, 190, 0, 17)
predLabel.BackgroundTransparency = 1
predLabel.Text = "Prediction:"
predLabel.TextColor3 = Color3.fromRGB(0, 170, 255)
predLabel.Font = Enum.Font.GothamBlack
predLabel.TextSize = 17
predLabel.TextXAlignment = Enum.TextXAlignment.Left
predLabel.LayoutOrder = 4

local predBox = Instance.new("TextBox", row1Frame)


predBox.Size = UDim2.new(0, 190, 0, 31)
predBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
predBox.TextColor3 = Color3.new(1, 1, 1)
predBox.PlaceholderText = "Enter Prediction"
predBox.PlaceholderColor3 = Color3.fromRGB(100, 200, 255)
predBox.Text = savedConfig and savedConfig.Prediction and
tostring(savedConfig.Prediction) or ""
predBox.Font = Enum.Font.GothamBlack
predBox.TextSize = 17
predBox.ClearTextOnFocus = false
predBox.LayoutOrder = 5
addCorner(predBox, 8)
addStroke(predBox, Color3.fromRGB(0, 170, 255), 2)

predBox.MouseEnter:Connect(function()
pcall(function()
predBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
end)
predBox.MouseLeave:Connect(function()
pcall(function()
predBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
end)

local keybindLabel = Instance.new("TextLabel", row1Frame)


keybindLabel.Size = UDim2.new(0, 190, 0, 17)
keybindLabel.BackgroundTransparency = 1
keybindLabel.Text = "Keybind:"
keybindLabel.TextColor3 = Color3.fromRGB(0, 170, 255)
keybindLabel.Font = Enum.Font.GothamBlack
keybindLabel.TextSize = 17
keybindLabel.TextXAlignment = Enum.TextXAlignment.Left
keybindLabel.LayoutOrder = 6

local keybindBox = Instance.new("TextBox", row1Frame)


keybindBox.Size = UDim2.new(0, 190, 0, 31)
keybindBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
keybindBox.TextColor3 = Color3.new(1, 1, 1)
keybindBox.PlaceholderText = "Enter Keybind"
keybindBox.PlaceholderColor3 = Color3.fromRGB(100, 200, 255)
keybindBox.Text = savedConfig and savedConfig.Keybind or "T"
keybindBox.Font = Enum.Font.GothamBlack
keybindBox.TextSize = 17
keybindBox.ClearTextOnFocus = false
keybindBox.LayoutOrder = 7
addCorner(keybindBox, 8)
addStroke(keybindBox, Color3.fromRGB(0, 170, 255), 2)

keybindBox.MouseEnter:Connect(function()
pcall(function()
keybindBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
end)
keybindBox.MouseLeave:Connect(function()
pcall(function()
keybindBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
end)

local noteLabel = Instance.new("TextLabel", row1Frame)


noteLabel.Size = UDim2.new(0, 190, 0, 13)
noteLabel.BackgroundTransparency = 1
noteLabel.Text = "Note: Hitbox Expander Works In Some Games."
noteLabel.TextColor3 = Color3.fromRGB(0, 170, 255)
noteLabel.Font = Enum.Font.GothamBlack
noteLabel.TextSize = 17
noteLabel.TextXAlignment = Enum.TextXAlignment.Left
noteLabel.LayoutOrder = 8
noteLabel.Position = UDim2.new(0, 0, 0.85, 0)

local hitboxToggle = Instance.new("TextButton", row2Frame)


hitboxToggle.Size = UDim2.new(0, 190, 0, 31)
hitboxToggle.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
hitboxToggle.TextColor3 = Color3.new(1, 1, 1)
hitboxToggle.Text = TriggerbotConfig.HitboxEnabled and "Hitbox: ON" or "Hitbox:
OFF"
hitboxToggle.Font = Enum.Font.GothamBlack
hitboxToggle.TextSize = 17
hitboxToggle.LayoutOrder = 1
addCorner(hitboxToggle, 8)
addStroke(hitboxToggle, Color3.fromRGB(0, 170, 255), 2)

hitboxToggle.MouseEnter:Connect(function()
pcall(function()
hitboxToggle.BackgroundColor3 = Color3.fromRGB(0, 200, 255)
end)
end)
hitboxToggle.MouseLeave:Connect(function()
pcall(function()
hitboxToggle.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
end)
end)

local hitboxSizeLabel = Instance.new("TextLabel", row2Frame)


hitboxSizeLabel.Size = UDim2.new(0, 190, 0, 17)
hitboxSizeLabel.BackgroundTransparency = 1
hitboxSizeLabel.Text = "Hitbox Size:"
hitboxSizeLabel.TextColor3 = Color3.fromRGB(0, 170, 255)
hitboxSizeLabel.Font = Enum.Font.GothamBlack
hitboxSizeLabel.TextSize = 17
hitboxSizeLabel.TextXAlignment = Enum.TextXAlignment.Left
hitboxSizeLabel.LayoutOrder = 2

local hitboxSizeBox = Instance.new("TextBox", row2Frame)


hitboxSizeBox.Size = UDim2.new(0, 190, 0, 31)
hitboxSizeBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
hitboxSizeBox.TextColor3 = Color3.new(1, 1, 1)
hitboxSizeBox.PlaceholderText = "Enter Delay"
hitboxSizeBox.PlaceholderColor3 = Color3.fromRGB(100, 200, 255)
hitboxSizeBox.Text = savedConfig and savedConfig.HitboxSize and
tostring(savedConfig.HitboxSize) or "15"
hitboxSizeBox.Font = Enum.Font.GothamBlack
hitboxSizeBox.TextSize = 17
hitboxSizeBox.ClearTextOnFocus = false
hitboxSizeBox.LayoutOrder = 3
addCorner(hitboxSizeBox, 8)
addStroke(hitboxSizeBox, Color3.fromRGB(0, 170, 255), 2)

hitboxSizeBox.MouseEnter:Connect(function()
pcall(function()
hitboxSizeBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
end)
hitboxSizeBox.MouseLeave:Connect(function()
pcall(function()
hitboxSizeBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
end)

local hitboxTransLabel = Instance.new("TextLabel", row2Frame)


hitboxTransLabel.Size = UDim2.new(0, 190, 0, 17)
hitboxTransLabel.BackgroundTransparency = 1
hitboxTransLabel.Text = "Hitbox Trans:"
hitboxTransLabel.TextColor3 = Color3.fromRGB(0, 170, 255)
hitboxTransLabel.Font = Enum.Font.GothamBlack
hitboxTransLabel.TextSize = 17
hitboxTransLabel.TextXAlignment = Enum.TextXAlignment.Left
hitboxTransLabel.LayoutOrder = 4

local hitboxTransBox = Instance.new("TextBox", row2Frame)


hitboxTransBox.Size = UDim2.new(0, 190, 0, 31)
hitboxTransBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
hitboxTransBox.TextColor3 = Color3.new(1, 1, 1)
hitboxTransBox.PlaceholderText = "Enter Prediction"
hitboxTransBox.PlaceholderColor3 = Color3.fromRGB(100, 200, 255)
hitboxTransBox.Text = savedConfig and savedConfig.HitboxTransparency and
tostring(savedConfig.HitboxTransparency) or "0.9"
hitboxTransBox.Font = Enum.Font.GothamBlack
hitboxTransBox.TextSize = 17
hitboxTransBox.ClearTextOnFocus = false
hitboxTransBox.LayoutOrder = 5
addCorner(hitboxTransBox, 8)
addStroke(hitboxTransBox, Color3.fromRGB(0, 170, 255), 2)

hitboxTransBox.MouseEnter:Connect(function()
pcall(function()
hitboxTransBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
end)
hitboxTransBox.MouseLeave:Connect(function()
pcall(function()
hitboxTransBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
end)

local function toggleTriggerbot()


local success, err = pcall(function()
TriggerbotConfig.Enabled = not TriggerbotConfig.Enabled
enableToggle.Text = TriggerbotConfig.Enabled and "Enabled" or "Disabled"
saveConfig({
Delay = TriggerbotConfig.Delay,
Prediction = TriggerbotConfig.Prediction,
Enabled = TriggerbotConfig.Enabled,
Keybind = TriggerbotConfig.Keybind,
HitboxEnabled = TriggerbotConfig.HitboxEnabled,
HitboxSize = TriggerbotConfig.HitboxSize,
HitboxTransparency = TriggerbotConfig.HitboxTransparency
})
end)
if not success then
warn("Failed to toggle triggerbot: " .. tostring(err))
end
end

toggleBtn.MouseButton1Click:Connect(function()
local success, err = pcall(function()
settingsFrame.Visible = not settingsFrame.Visible
end)
if not success then
warn("Failed to toggle menu: " .. tostring(err))
end
end)

enableToggle.MouseButton1Click:Connect(toggleTriggerbot)

keybindBox.FocusLost:Connect(function(enter)
if enter then
local success, err = pcall(function()
local key = keybindBox.Text:upper()
if #key == 1 and key:match("%a") then
TriggerbotConfig.Keybind = key
keybindBox.Text = key
saveConfig({
Delay = TriggerbotConfig.Delay,
Prediction = TriggerbotConfig.Prediction,
Enabled = TriggerbotConfig.Enabled,
Keybind = TriggerbotConfig.Keybind,
HitboxEnabled = TriggerbotConfig.HitboxEnabled,
HitboxSize = TriggerbotConfig.HitboxSize,
HitboxTransparency = TriggerbotConfig.HitboxTransparency
})
else
keybindBox.Text = TriggerbotConfig.Keybind
end
end)
if not success then
warn("Failed to update keybind: " .. tostring(err))
keybindBox.Text = TriggerbotConfig.Keybind
end
end
end)

UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
local success, err = pcall(function()
if input.UserInputType == Enum.UserInputType.Keyboard then
local key = input.KeyCode.Name:upper()
if key == TriggerbotConfig.Keybind then
toggleTriggerbot()
end
end
end)
if not success then
warn("Failed to process keybind: " .. tostring(err))
end
end)

local function trySave()


local success, err = pcall(function()
saveConfig({
Delay = TriggerbotConfig.Delay,
Prediction = TriggerbotConfig.Prediction,
Enabled = TriggerbotConfig.Enabled,
Keybind = TriggerbotConfig.Keybind,
HitboxEnabled = TriggerbotConfig.HitboxEnabled,
HitboxSize = TriggerbotConfig.HitboxSize,
HitboxTransparency = TriggerbotConfig.HitboxTransparency
})
end)
if not success then
warn("Failed to save config: " .. tostring(err))
end
end

delayBox.FocusLost:Connect(function(enter)
if enter then
local success, err = pcall(function()
local v = tonumber(delayBox.Text)
if v and v >= 0 then
TriggerbotConfig.Delay = v
delayBox.Text = tostring(v)
trySave()
else
delayBox.Text = ""
delayBox.PlaceholderText = "Enter Delay"
end
end)
if not success then
warn("Failed to update delay: " .. tostring(err))
delayBox.Text = ""
delayBox.PlaceholderText = "Enter Delay"
end
end
end)

predBox.FocusLost:Connect(function(enter)
if enter then
local success, err = pcall(function()
local v = tonumber(predBox.Text)
if v and v >= 0 then
TriggerbotConfig.Prediction = v
predBox.Text = tostring(v)
trySave()
else
predBox.Text = ""
predBox.PlaceholderText = "Enter Prediction"
end
end)
if not success then
warn("Failed to update prediction: " .. tostring(err))
predBox.Text = ""
predBox.PlaceholderText = "Enter Prediction"
end
end
end)

hitboxToggle.MouseButton1Click:Connect(function()
local success, err = pcall(function()
TriggerbotConfig.HitboxEnabled = not TriggerbotConfig.HitboxEnabled
hitboxToggle.Text = TriggerbotConfig.HitboxEnabled and "Hitbox: ON" or
"Hitbox: OFF"
trySave()
end)
if not success then
warn("Failed to toggle hitbox: " .. tostring(err))
end
end)

hitboxSizeBox.FocusLost:Connect(function(enter)
if enter then
local success, err = pcall(function()
local v = tonumber(hitboxSizeBox.Text)
if v and v >= 0 then
TriggerbotConfig.HitboxSize = v
hitboxSizeBox.Text = tostring(v)
trySave()
else
hitboxSizeBox.Text = ""
hitboxSizeBox.PlaceholderText = "Enter Delay"
end
end)
if not success then
warn("Failed to update hitbox size: " .. tostring(err))
hitboxSizeBox.Text = ""
hitboxSizeBox.PlaceholderText = "Enter Delay"
end
end
end)

hitboxTransBox.FocusLost:Connect(function(enter)
if enter then
local success, err = pcall(function()
local v = tonumber(hitboxTransBox.Text)
if v and v >= 0 and v <= 1 then
TriggerbotConfig.HitboxTransparency = v
hitboxTransBox.Text = tostring(v)
trySave()
else
hitboxTransBox.Text = ""
hitboxTransBox.PlaceholderText = "Enter Prediction"
end
end)
if not success then
warn("Failed to update hitbox transparency: " .. tostring(err))
hitboxTransBox.Text = ""
hitboxTransBox.PlaceholderText = "Enter Prediction"
end
end
end)

local specialGames = {
[93579217841822] = true
}

local raycastParams = RaycastParams.new()


raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.IgnoreWater = true
local lastShot = 0

local function isEnemy(character)


print("isEnemy called for:", character and character.Name or "nil")
if not character then
print("isEnemy: No character provided")
return false
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health <= 0 or
Players:GetPlayerFromCharacter(character) == player then
print("isEnemy: Invalid humanoid, health <= 0, or local player")
return false
end

local localTool = player.Character and


player.Character:FindFirstChildOfClass("Tool")
if localTool and (localTool.Name:lower():find("knife") or
localTool.Name:lower():find("blade") or localTool.Name:lower():find("dagger") or
localTool.Name:lower():find("combat") or localTool.Name:lower():find("melee") or
localTool.Name:lower():find("sword") or localTool.ClassName:lower():find("knife")
or localTool.ClassName:lower():find("blade")) then
print('[XShot.cc] isEnemy: Local player has knife, ignoring:',
character.Name)
return false
end
print("isEnemy: Valid enemy:", character.Name)
return true
end

local function doShoot()


local success, err = pcall(function()
local tool = player.Character and
player.Character:FindFirstChildOfClass("Tool")
if tool then
tool:Activate()
print("doShoot: Tool activated")
else
print("doShoot: No tool found")
end
end)
if not success then
warn("Failed to activate tool: " .. tostring(err))
end
end

RunService.RenderStepped:Connect(function()
print("RenderStepped: Triggerbot enabled check:", TriggerbotConfig.Enabled)
if not TriggerbotConfig.Enabled then
print("RenderStepped: Triggerbot disabled")
return
end

local success, err = pcall(function()


raycastParams.FilterDescendantsInstances = { player.Character }
local cx, cy = camera.ViewportSize.X / 2, camera.ViewportSize.Y / 2
local ray = camera:ViewportPointToRay(cx, cy)
local origin = ray.Origin
local direction = ray.Direction
local centerResult = workspace:Raycast(origin, direction * 1000,
raycastParams)
if centerResult and centerResult.Instance then
local targetChar =
centerResult.Instance:FindFirstAncestorOfClass("Model")
print("Raycast hit:", targetChar and targetChar.Name or "None")
if isEnemy(targetChar) then
local targetPos = centerResult.Position
if TriggerbotConfig.Prediction > 0 then
local rootPart = targetChar:FindFirstChild("HumanoidRootPart")
or targetChar:FindFirstChild("Torso") or targetChar:FindFirstChild("UpperTorso")
if rootPart then
targetPos = rootPart.Position + rootPart.Velocity *
TriggerbotConfig.Prediction
end
end
local toAim = (targetPos - origin).Unit
local predictedResult = workspace:Raycast(origin, toAim * 1000,
raycastParams)
if predictedResult and predictedResult.Instance and
predictedResult.Instance:IsDescendantOf(targetChar) then
print("Valid target confirmed:", targetChar.Name)
if tick() - lastShot >= TriggerbotConfig.Delay then
if specialGames[game.PlaceId] then
local tool =
player.Character:FindFirstChildOfClass("Tool")
if tool then
pcall(function()
tool:Activate()
print("Special game tool activated")
end)
else
print("Special game: No tool found")
end
else
doShoot()
end
lastShot = tick()
end
else
print("Predicted raycast failed or not descendant of target")
end
else
print("Target not an enemy")
end
else
print("No raycast hit")
end
end)
if not success then
warn("Error in triggerbot: " .. tostring(err))
end

if TriggerbotConfig.HitboxEnabled then
for _, v in pairs(Players:GetPlayers()) do
if v ~= player then
pcall(function()
local hrp = v.Character and
v.Character:FindFirstChild("HumanoidRootPart")
if hrp then
hrp.Size = Vector3.new(TriggerbotConfig.HitboxSize,
TriggerbotConfig.HitboxSize, TriggerbotConfig.HitboxSize)
hrp.Transparency = TriggerbotConfig.HitboxTransparency
hrp.BrickColor = BrickColor.new("Really black")
hrp.Material = Enum.Material.Neon
hrp.CanCollide = false
end
end)
end
end
else
for _, v in pairs(Players:GetPlayers()) do
if v ~= player then
pcall(function()
local hrp = v.Character and
v.Character:FindFirstChild("HumanoidRootPart")
if hrp then
hrp.Size = Vector3.new(2, 2, 1)
hrp.Transparency = 1
hrp.BrickColor = BrickColor.new("Medium stone grey")
hrp.Material = Enum.Material.Plastic
hrp.CanCollide = false
end
end)
end
end
end
end)

You might also like