local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
local UserInputService = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer
local Camera = Workspace.CurrentCamera
local PlayerScripts = LocalPlayer.PlayerScripts
local GunModule = require(PlayerScripts.Modules.ItemTypes.Gun)
local UtilityModule = require(ReplicatedStorage.Modules.Utility)

local CharacterParts = {}
setmetatable(CharacterParts, {
    __index = function(_, key)
        local char = LocalPlayer.Character
        if not char then return nil end
        if key == "root" then
            return char:FindFirstChild("HumanoidRootPart")
        elseif key == "head" then
            return char:FindFirstChild("Head")
        end
        return nil
    end
})

local Ragebot = {}
getgenv().Ragebot = Ragebot

function Ragebot:Init()
    self.Active = true
    self.Target = nil
    self.Desync = false
    self.Conn1 = nil
    self.Conn2 = nil
    self.Task1 = nil
    self.OldFunc = nil
    self:Setup()
end

function Ragebot:Setup()
    self.Conn1 = RunService.Heartbeat:Connect(function()
        if not self.Active then return end
        self.Target = self:FindTarget()
    end)

    local originalStartShooting = GunModule.StartShooting
    self.OldFunc = originalStartShooting
    
    GunModule.StartShooting = function(item, ...)
        local results = {originalStartShooting(item, ...)}
        
        if not item.ClientFighter or not item.ClientFighter.IsLocalPlayer then
            return unpack(results)
        end
        
        local data = results[3]
        if not data or typeof(data) ~= "table" then
            return unpack(results)
        end
        
        results[4] = true
        local target = self.Target
        
        if not self.Active or not target or not target.Character then
            return unpack(results)
        end
        
        if not self.Desync or self.CurrentTarget ~= target then
            self:StartDesync(target)
            task.wait(0.1)
        end
        
        if self.Task1 then
            task.cancel(self.Task1)
            self.Task1 = nil
        end
        
        local head = target.Character:FindFirstChild("Head")
        if not head then return unpack(results) end
        
        local headPos = head.Position
        local headCFrame = head.CFrame
        local belowPos = headPos - Vector3.new(0, 5, 0)
        local lookCFrame = CFrame.lookAt(belowPos, headPos)
        local randomOffset = headCFrame:ToObjectSpace(CFrame.new(headPos + Vector3.new(math.random(), math.random(), math.random())))
        
        data[utf8.char(0)] = UtilityModule:EncodeCFrame(CFrame.new(belowPos, headPos) * CFrame.Angles(lookCFrame:ToOrientation()))
        data[utf8.char(1)] = UtilityModule:EncodeCFrame(CFrame.new(headPos) * CFrame.Angles(lookCFrame:ToOrientation()))
        data[utf8.char(2)] = head
        data[utf8.char(3)] = UtilityModule:EncodeCFrame(randomOffset)
        
        self.Task1 = task.delay(0.15, function()
            self:StopDesync()
        end)
        
        return unpack(results)
    end
end

function Ragebot:FindTarget()
    local myChar = LocalPlayer.Character
    if not myChar then return nil end
    local myRoot = myChar:FindFirstChild("HumanoidRootPart")
    if not myRoot then return nil end
    
    local closest = nil
    local closestDist = math.huge
    local MAX_DISTANCE = 200
    
    for _, player in pairs(Players:GetPlayers()) do
        if player == LocalPlayer then continue end
        if player:GetAttribute("TeamID") == LocalPlayer:GetAttribute("TeamID") then continue end
        
        local char = player.Character
        if not char then continue end
        
        local root = char:FindFirstChild("HumanoidRootPart")
        local head = char:FindFirstChild("Head")
        local hum = char:FindFirstChildWhichIsA("Humanoid")
        
        if not (root and head and hum and hum.Health > 0) then continue end
        
        local dist = (myRoot.Position - root.Position).Magnitude
        if dist > MAX_DISTANCE then continue end
        
        if dist < closestDist then
            closestDist = dist
            closest = player
        end
    end
    
    return closest
end

function Ragebot:StartDesync(target)
    if self.Conn2 then self.Conn2:Disconnect() end
    self.Desync = true
    self.CurrentTarget = target
    
    self.Conn2 = RunService.Heartbeat:Connect(function()
        if not self.Desync then return end
        local myRoot = CharacterParts.root
        if not myRoot then return end
        
        local targetRoot = target.Character and target.Character:FindFirstChild("HumanoidRootPart")
        if not targetRoot then
            self:StopDesync()
            return
        end
        
        local originalCFrame = myRoot.CFrame
        local originalVelocity = myRoot.Velocity
        local originalRotVelocity = myRoot.RotVelocity
        
        myRoot.CFrame = targetRoot.CFrame * CFrame.new(0, -5, 0)
        
        RunService:BindToRenderStep("Restore", 101, function()
            myRoot.CFrame = originalCFrame
            myRoot.Velocity = originalVelocity
            myRoot.RotVelocity = originalRotVelocity
            RunService:UnbindFromRenderStep("Restore")
        end)
    end)
end

function Ragebot:StopDesync()
    self.Desync = false
    self.CurrentTarget = nil
    if self.Conn2 then
        self.Conn2:Disconnect()
        self.Conn2 = nil
    end
end

function Ragebot:Shutdown()
    self.Active = false
    if self.Conn1 then self.Conn1:Disconnect() end
    if self.Conn2 then self.Conn2:Disconnect() end
    if self.Task1 then task.cancel(self.Task1) end
    if self.OldFunc then
        GunModule.StartShooting = self.OldFunc
    end
end

Ragebot:Init()

print("Ragebot Loaded!")
print("Active: " .. tostring(Ragebot.Active))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: