Name
Hi my name is Baccon!
What am i trying to do
So, I was sent this script and it’s an aimbot script… i need some tips on how i would be able to prevent this script.
Script
local players = game:GetService("Players")
local uis = game:GetService("UserInputService")
local player = players.LocalPlayer
local UI = Instance.new("ScreenGui")
local Destruct = Instance.new("TextButton")
local Notify = Instance.new("TextLabel")
UI.Name = "UI"
UI.Parent = game.CoreGui
Destruct.Name = "Destruct"
Destruct.Parent = UI
Destruct.BackgroundColor3 = Color3.new(1, 1, 1)
Destruct.BorderSizePixel = 0
Destruct.Position = UDim2.new(0.864374995, 0, 0.254732537, 0)
Destruct.Size = UDim2.new(0.125, 0, 0.035665296, 0)
Destruct.Font = Enum.Font.GothamBlack
Destruct.Text = "Self Destruct UI"
Destruct.TextColor3 = Color3.new(0, 0, 0)
Destruct.TextSize = 14
Notify.Name = "Notify"
Notify.Parent = UI
Notify.BackgroundColor3 = Color3.new(1, 1, 1)
Notify.BorderSizePixel = 0
Notify.Position = UDim2.new(0.864374995, 0, 0.202606308, 0)
Notify.Size = UDim2.new(0.125, 0, 0.0260630995, 0)
Notify.Font = Enum.Font.SourceSans
Notify.Text = "It is on."
Notify.TextColor3 = Color3.new(0, 0, 0)
Notify.TextSize = 14
local meta = getrawmetatable(game)
local old = meta.__namecall
setreadonly(meta, false)
local goals = {}
local shotkey = Enum.KeyCode.X
local toggle = true
do
for i, v in pairs(workspace:GetDescendants()) do
--[ CHECK ]--
if (v:FindFirstChild("Anti Aimbot") and v:IsA("BasePart")) then
table.insert(goals, v)
end
end
end
--[ LOCAL_FUNCTIONS ]--
local function Check(mag)
--[ CHECK_MAGNITUDE ]--
if (mag > 100) then
return 100
else
return mag
end
end
local function Distance(obj1, obj2)
return (obj1.Position - obj2.Position).magnitude
end
local function GetClosest(root)
local distances = {}
for _, v in pairs(goals) do
table.insert(distances, Distance(root,v))
end
local closest = math.min(unpack(distances))
for _, v in pairs(goals) do
local distance = Distance(root, v)
if (distance == closest) then
return v
end
end
end
Destruct.MouseButton1Click:Connect(function()
toggle = false
UI:Destroy()
end)
uis.InputBegan:Connect(function(key, gpe)
if (gpe) then
return
end
if (key.KeyCode == shotkey) then
toggle = not toggle
if (UI and Notify) then
Notify.Text = "It is " .. (toggle and "on" or "off") .. "."
end
end
end)
meta.__namecall = newcclosure(function(self, ...)
local method = getnamecallmethod()
local args = {...}
if (method == "FireServer" and self.Name == "BallRemote") then
if (typeof(args[1]) == "Vector3" and toggle) then
local character = player.Character
local root = character.HumanoidRootPart
local goal = GetClosest(root)
local disp = (character.Torso.Position - goal.Position)
local mag = disp.magnitude
--[ SET ]--
args[1] = (goal.CFrame * CFrame.new(0, 0, 0)).Position + Vector3.new(0, (mag * 0.90), 0)
return old(self, unpack(args))
end
end
return old(self, unpack(args))
end)
setreadonly(meta, true)