Elite Scripts Rivals

Elite Scripts RIVALS OpenSource script keyless

Blox Fruits is an immensely popular game on the Roblox platform, boasting a vast user base. SElite Scripts RIVALS This action-adventure game revolves around a pirate theme, where players enagage in combat against a variety of enemies and challenging bosses. Exploring islands and consuming different fruits are essential for advancing your character’s level. This is a free and keyless script forAttack on Titan Revolution with Auto Farm, Safe Farm, and many more features

Elite Scripts Rivals  

Description

This is an open-source RIVALS script developed by Elite Scripts, featuring aimbot, FOV customization, aim prediction, and many other features. Since the script is open source, you can also customize and modify the code with the help of AI.

How to Use Roblox Script?

  1. Launch Roblox and join your desired game.
  2. Click the “Copy” button to duplicate the script code.
  3. Paste the script code into your preferred Roblox executor.
  4. Execute the script code and savor the enhanced experience.

Game Name

RIVALS

Aim Part FOV Circle Smoothing Prediction Multiplier Show FOV FOV Color Enable ESP Box Health Bar Skeleton Tracers Bullet Tracers Team Check

--[[
    ELITE EXECUTOR  ·  RIVALS
    Working script (executor) — 

    AIM · ESP (box/skel/tracer/name/dist/health) · Bullet tracers
    Rage (fly/noclip/speed) · Unlock cosmetics (client) · FPS
    About + Discord

    Use: paste into Xeno / JJSploit / any UNC executor while in Rivals
    Keyless · free
]]

local Rayfield = loadstring(game:HttpGet("https://sirius.menu/rayfield"))()

local Players          = game:GetService("Players")
local RunService       = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Workspace        = game:GetService("Workspace")
local Lighting         = game:GetService("Lighting")
local TweenService     = game:GetService("TweenService")
local StarterGui       = game:GetService("StarterGui")

local LocalPlayer = Players.LocalPlayer
local Camera      = Workspace.CurrentCamera
local Mouse       = LocalPlayer:GetMouse()

-- ======================== SETTINGS ========================
local S = {
    -- Aim
    Aimbot        = false,
    SilentAim     = false, -- soft: forces aim part toward target while firing
    AlwaysOn      = false,
    AimKey        = Enum.UserInputType.MouseButton2,
    FOV           = 140,
    Smoothness    = 0.12,   -- lower = smoother
    AimPart       = "Head", -- Head | UpperTorso | HumanoidRootPart | LowerTorso
    TeamCheck     = true,
    WallCheck     = true,
    Prediction    = true,
    PredMult      = 0.09,
    ShowFOV       = true,
    FOVColor      = Color3.fromRGB(180, 80, 255),

    -- ESP
    ESP           = true,
    Box           = true,
    Skeleton      = true,
    Tracer        = true,
    Name          = true,
    Distance      = true,
    Health        = true,
    ESPTeamCheck  = true,
    MaxDist       = 2000,
    BoxColor      = Color3.fromRGB(188, 78, 255),
    SkelColor     = Color3.fromRGB(210, 120, 255),
    TracerColor   = Color3.fromRGB(160, 60, 240),
    NameColor     = Color3.fromRGB(240, 230, 255),

    -- Bullet tracers
    BulletTracer  = true,
    BulletColor   = Color3.fromRGB(255, 90, 220),
    BulletThick   = 2,
    BulletLife    = 1.2,
    BulletMaxDist = 1200,

    -- Rage / movement
    Fly           = false,
    FlySpeed      = 80,
    Noclip        = false,
    Speed         = false,
    WalkSpeed     = 24,
    InfiniteJump  = false,

    -- Visual / unlock-ish
    FullBright    = false,
    NoFog         = false,
    CustomSky     = false,

    -- FPS / misc weapon flags
    FPSUnlock     = false,
    AutoReload    = false,
    NoRecoil      = false,
    NoSpread      = false,
    UnlockCam     = false,

    -- Discord LED footer
    DiscordLED       = true,
    DiscordLEDColor  = Color3.fromRGB(188, 78, 255),
    DiscordLink      = "https://discord.gg/JyHTa3M7h",

    AutoReattach  = true,
}

-- ======================== STATE ========================
local HoldingAim = false
local espCache   = {}
local bullets    = {}
local lastShot   = 0
local flyBV, flyBG

local FOVCircle = Drawing.new("Circle")
FOVCircle.Visible = false
FOVCircle.Thickness = 1.4
FOVCircle.Filled = false
FOVCircle.NumSides = 64
FOVCircle.Transparency = 0.75
FOVCircle.Color = S.FOVColor
FOVCircle.Radius = S.FOV

-- LED Discord footer — small, subtle, bottom center
local DiscordLEDGlow = Drawing.new("Text")
DiscordLEDGlow.Text = "discord.gg/JyHTa3M7h"
DiscordLEDGlow.Size = 13
DiscordLEDGlow.Center = true
DiscordLEDGlow.Outline = false
DiscordLEDGlow.Color = S.DiscordLEDColor
DiscordLEDGlow.Transparency = 0.72
DiscordLEDGlow.Visible = S.DiscordLED

local DiscordLEDText = Drawing.new("Text")
DiscordLEDText.Text = "discord.gg/JyHTa3M7h"
DiscordLEDText.Size = 12
DiscordLEDText.Center = true
DiscordLEDText.Outline = true
DiscordLEDText.Color = S.DiscordLEDColor
DiscordLEDText.Transparency = 1
DiscordLEDText.Visible = S.DiscordLED

local DiscordLEDLine = Drawing.new("Line")
DiscordLEDLine.Thickness = 1
DiscordLEDLine.Color = S.DiscordLEDColor
DiscordLEDLine.Transparency = 0.6
DiscordLEDLine.Visible = S.DiscordLED

-- ======================== UI ========================
local Window = Rayfield:CreateWindow({
    Name = "Elite Scripts",
    LoadingTitle = "Elite Scripts",
    LoadingSubtitle = "Rivals",
    Theme = "Default",
    ConfigurationSaving = {
        Enabled = true,
        FolderName = "EliteScripts",
        FileName = "RivalsConfig"
    },
    Discord = { Enabled = false },
    KeySystem = false
})

-- Sidebar-style tabs matching common Rivals UIs
local AimTab     = Window:CreateTab("Aimbot", 4483362458)
local VisualsTab = Window:CreateTab("Visuals", 4483362458)
local PlayerTab  = Window:CreateTab("Player", 4483362458)
local WeaponsTab = Window:CreateTab("Weapons", 4483362458)
local MiscTab    = Window:CreateTab("Misc", 4483362458)
local SettingsTab = Window:CreateTab("Settings", 4483362458)
local ConfigsTab = Window:CreateTab("Configs", 4483362458)

-- AIMBOT (like reference: Enable / Silent / Prediction / Aim Part / FOV / Smoothing)
AimTab:CreateSection("Aimbot")
AimTab:CreateToggle({ Name = "Enable Aimbot", CurrentValue = false, Flag = "Aimbot", Callback = function(v)
    S.Aimbot = v
    FOVCircle.Visible = v and S.ShowFOV
end })
AimTab:CreateToggle({ Name = "Silent Aim", CurrentValue = false, Flag = "Silent", Callback = function(v) S.SilentAim = v end })
AimTab:CreateToggle({ Name = "Aim Prediction", CurrentValue = true, Flag = "Pred", Callback = function(v) S.Prediction = v end })
AimTab:CreateToggle({ Name = "Always On", CurrentValue = false, Flag = "AlwaysOn", Callback = function(v) S.AlwaysOn = v end })
AimTab:CreateToggle({ Name = "Team Check", CurrentValue = true, Flag = "TeamCheck", Callback = function(v) S.TeamCheck = v end })
AimTab:CreateToggle({ Name = "Wall Check", CurrentValue = true, Flag = "WallCheck", Callback = function(v) S.WallCheck = v end })
AimTab:CreateDropdown({
    Name = "Aim Part",
    Options = {"Head", "UpperTorso", "HumanoidRootPart", "LowerTorso"},
    CurrentOption = {"Head"},
    Flag = "AimPart",
    Callback = function(o) S.AimPart = type(o) == "table" and o[1] or o end
})
AimTab:CreateSlider({ Name = "FOV Circle", Range = {40, 400}, Increment = 5, CurrentValue = 150, Flag = "FOV", Callback = function(v)
    S.FOV = v
    FOVCircle.Radius = v
end })
AimTab:CreateSlider({ Name = "Smoothing", Range = {0.03, 0.40}, Increment = 0.01, CurrentValue = 0.25, Flag = "Smooth", Callback = function(v) S.Smoothness = v end })
AimTab:CreateSlider({ Name = "Prediction Mult", Range = {0.02, 0.25}, Increment = 0.01, CurrentValue = 0.09, Flag = "PredM", Callback = function(v) S.PredMult = v end })
AimTab:CreateToggle({ Name = "Show FOV", CurrentValue = true, Flag = "ShowFOV", Callback = function(v)
    S.ShowFOV = v
    FOVCircle.Visible = v and S.Aimbot
end })
AimTab:CreateColorPicker({ Name = "FOV Color", Color = S.FOVColor, Flag = "FOVCol", Callback = function(c)
    S.FOVColor = c
    FOVCircle.Color = c
end })

-- VISUALS / ESP
VisualsTab:CreateSection("ESP")
VisualsTab:CreateToggle({ Name = "Enable ESP", CurrentValue = true, Flag = "ESP", Callback = function(v)
    S.ESP = v
    if not v then
        for _, objs in pairs(espCache) do
            for _, d in pairs(objs) do
                if typeof(d) == "table" then
                    for _, x in pairs(d) do if x and x.Visible ~= nil then x.Visible = false end end
                elseif d and d.Visible ~= nil then
                    d.Visible = false
                end
            end
        end
    end
end })
VisualsTab:CreateToggle({ Name = "Box", CurrentValue = true, Flag = "Box", Callback = function(v) S.Box = v end })
VisualsTab:CreateToggle({ Name = "Health Bar", CurrentValue = true, Flag = "HP", Callback = function(v) S.Health = v end })
VisualsTab:CreateToggle({ Name = "Distance", CurrentValue = true, Flag = "Dist", Callback = function(v) S.Distance = v end })
VisualsTab:CreateToggle({ Name = "Name", CurrentValue = true, Flag = "Name", Callback = function(v) S.Name = v end })
VisualsTab:CreateToggle({ Name = "Skeleton", CurrentValue = true, Flag = "Skel", Callback = function(v) S.Skeleton = v end })
VisualsTab:CreateToggle({ Name = "Tracers", CurrentValue = true, Flag = "Tracer", Callback = function(v) S.Tracer = v end })
VisualsTab:CreateToggle({ Name = "Bullet Tracers", CurrentValue = true, Flag = "BT", Callback = function(v) S.BulletTracer = v end })
VisualsTab:CreateToggle({ Name = "Team Check", CurrentValue = true, Flag = "ESPTeam", Callback = function(v) S.ESPTeamCheck = v end })
VisualsTab:CreateSlider({ Name = "Max Distance", Range = {100, 4000}, Increment = 50, CurrentValue = 2000, Flag = "MaxD", Callback = function(v) S.MaxDist = v end })
VisualsTab:CreateSection("Colors")
VisualsTab:CreateColorPicker({ Name = "Box", Color = S.BoxColor, Flag = "BoxC", Callback = function(c) S.BoxColor = c end })
VisualsTab:CreateColorPicker({ Name = "Skeleton", Color = S.SkelColor, Flag = "SkelC", Callback = function(c) S.SkelColor = c end })
VisualsTab:CreateColorPicker({ Name = "Tracer", Color = S.TracerColor, Flag = "TrC", Callback = function(c) S.TracerColor = c end })
VisualsTab:CreateColorPicker({ Name = "Name", Color = S.NameColor, Flag = "NmC", Callback = function(c) S.NameColor = c end })
VisualsTab:CreateColorPicker({ Name = "Bullet Tracer", Color = S.BulletColor, Flag = "BTC", Callback = function(c) S.BulletColor = c end })

-- RAGE
PlayerTab:CreateSection("Movement")
PlayerTab:CreateToggle({ Name = "Fly", CurrentValue = false, Flag = "Fly", Callback = function(v)
    S.Fly = v
    local char = LocalPlayer.Character
    local hrp = char and char:FindFirstChild("HumanoidRootPart")
    local hum = char and char:FindFirstChildOfClass("Humanoid")
    if not v then
        if flyBV then flyBV:Destroy() flyBV = nil end
        if flyBG then flyBG:Destroy() flyBG = nil end
        if hum then hum.PlatformStand = false end
        return
    end
    if not hrp or not hum then return end
    hum.PlatformStand = true
    flyBV = Instance.new("BodyVelocity")
    flyBV.MaxForce = Vector3.new(9e9, 9e9, 9e9)
    flyBV.Velocity = Vector3.zero
    flyBV.Parent = hrp
    flyBG = Instance.new("BodyGyro")
    flyBG.MaxTorque = Vector3.new(9e9, 9e9, 9e9)
    flyBG.P = 9e4
    flyBG.Parent = hrp
end })
PlayerTab:CreateSlider({ Name = "Fly Speed", Range = {20, 200}, Increment = 5, CurrentValue = 80, Flag = "FlySp", Callback = function(v) S.FlySpeed = v end })
PlayerTab:CreateToggle({ Name = "Noclip", CurrentValue = false, Flag = "Noclip", Callback = function(v) S.Noclip = v end })
PlayerTab:CreateToggle({ Name = "Speed", CurrentValue = false, Flag = "Speed", Callback = function(v)
    S.Speed = v
    local hum = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
    if hum then hum.WalkSpeed = v and S.WalkSpeed or 16 end
end })
PlayerTab:CreateSlider({ Name = "WalkSpeed", Range = {16, 80}, Increment = 1, CurrentValue = 24, Flag = "WS", Callback = function(v)
    S.WalkSpeed = v
    if S.Speed then
        local hum = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
        if hum then hum.WalkSpeed = v end
    end
end })
PlayerTab:CreateToggle({ Name = "Infinite Jump", CurrentValue = false, Flag = "InfJ", Callback = function(v) S.InfiniteJump = v end })
PlayerTab:CreateParagraph({
    Title = "Note",
    Content = "Teleport / wallbang / rapid-fire on Rivals need game-specific remotes and are not force-enabled here. Fly, noclip, speed, jump work client-side."
})

-- WEAPONS (placeholders for Rivals weapon helpers)
WeaponsTab:CreateSection("Weapons")
WeaponsTab:CreateToggle({ Name = "Auto Reload", CurrentValue = false, Flag = "AutoReload", Callback = function(v) S.AutoReload = v end })
WeaponsTab:CreateToggle({ Name = "No Recoil", CurrentValue = false, Flag = "NoRecoil", Callback = function(v) S.NoRecoil = v end })
WeaponsTab:CreateToggle({ Name = "No Spread", CurrentValue = false, Flag = "NoSpread", Callback = function(v) S.NoSpread = v end })
WeaponsTab:CreateParagraph({
    Title = "Note",
    Content = "No Recoil / No Spread need Rivals weapon remotes to fully work. Toggles are wired for when those paths are added."
})

-- MISC / VISUAL
MiscTab:CreateSection("Misc")
MiscTab:CreateToggle({ Name = "Unlock Camera", CurrentValue = false, Flag = "UnlockCam", Callback = function(v) S.UnlockCam = v end })
MiscTab:CreateSection("Client visuals")
MiscTab:CreateToggle({ Name = "Fullbright", CurrentValue = false, Flag = "FB", Callback = function(v)
    S.FullBright = v
    if v then
        Lighting.Brightness = 2
        Lighting.ClockTime = 14
        Lighting.FogEnd = 1e6
        Lighting.GlobalShadows = false
        Lighting.OutdoorAmbient = Color3.fromRGB(180, 180, 180)
    else
        Lighting.Brightness = 1
        Lighting.GlobalShadows = true
    end
end })
MiscTab:CreateToggle({ Name = "No Fog", CurrentValue = false, Flag = "NoFog", Callback = function(v)
    S.NoFog = v
    Lighting.FogEnd = v and 1e6 or 100000
end })
MiscTab:CreateToggle({ Name = "Purple Sky tint", CurrentValue = false, Flag = "Sky", Callback = function(v)
    S.CustomSky = v
    if v then
        Lighting.Ambient = Color3.fromRGB(40, 20, 60)
        Lighting.OutdoorAmbient = Color3.fromRGB(80, 50, 120)
    end
end })
MiscTab:CreateParagraph({
    Title = "Skins / charms / emotes",
    Content = "Full server-side unlock-all is not possible from a client script alone. Visual boosts above work. Skin changers need Rivals-specific remote paths and break often."
})

-- SETTINGS
SettingsTab:CreateSection("Info")
SettingsTab:CreateParagraph({
    Title = "Status",
    Content = "Status: Injected\nGame: Rivals\nVersion: 1.0.0\nDeveloper: IKonIK"
})
SettingsTab:CreateSection("Performance")
SettingsTab:CreateToggle({ Name = "FPS Unlock attempt", CurrentValue = false, Flag = "FPS", Callback = function(v)
    S.FPSUnlock = v
    if v then
        pcall(function()
            setfpscap(0)
        end)
        pcall(function()
            settings().Rendering.QualityLevel = Enum.QualityLevel.Level01
        end)
    else
        pcall(function() setfpscap(60) end)
    end
end })
SettingsTab:CreateParagraph({
    Title = "Tip",
    Content = "FPS unlock depends on your executor supporting setfpscap. Lower graphics helps more than any toggle."
})

-- ABOUT
ConfigsTab:CreateParagraph({
    Title = "Elite Scripts",
    Content = "Thank you for using Elite Scripts! Join the Discord down below i gladly appreciate it\n\nhappy gaming,\nIKonIK"
})
ConfigsTab:CreateParagraph({
    Title = "Discord",
    Content = "https://discord.gg/JyHTa3M7h"
})
ConfigsTab:CreateButton({
    Name = "Copy Discord Link",
    Callback = function()
        if setclipboard then
            setclipboard(S.DiscordLink)
            Rayfield:Notify({ Title = "Elite", Content = "Discord link copied", Duration = 3 })
        else
            Rayfield:Notify({ Title = "Elite", Content = S.DiscordLink, Duration = 5 })
        end
    end
})
ConfigsTab:CreateSection("LED Discord bar (screen bottom)")
ConfigsTab:CreateToggle({
    Name = "Show LED Discord bar",
    CurrentValue = true,
    Flag = "DiscordLED",
    Callback = function(v)
        S.DiscordLED = v
        if DiscordLEDText then DiscordLEDText.Visible = v end
        if DiscordLEDGlow then DiscordLEDGlow.Visible = v end
        if DiscordLEDLine then DiscordLEDLine.Visible = v end
    end
})
ConfigsTab:CreateColorPicker({
    Name = "LED Color",
    Color = Color3.fromRGB(188, 78, 255),
    Flag = "DiscordLEDColor",
    Callback = function(c)
        S.DiscordLEDColor = c
        if DiscordLEDText then DiscordLEDText.Color = c end
        if DiscordLEDGlow then DiscordLEDGlow.Color = c end
        if DiscordLEDLine then DiscordLEDLine.Color = c end
    end
})

-- ======================== HELPERS ========================
local function isEnemy(plr)
    if plr == LocalPlayer then return false end
    if not S.TeamCheck and not S.ESPTeamCheck then return true end
    if LocalPlayer.Team and plr.Team and LocalPlayer.Team == plr.Team then
        return false
    end
    return true
end

local function visible(from, to, ignore)
    local params = RaycastParams.new()
    params.FilterType = Enum.RaycastFilterType.Exclude
    params.FilterDescendantsInstances = ignore or { LocalPlayer.Character }
    params.IgnoreWater = true
    local dir = to - from
    local result = Workspace:Raycast(from, dir, params)
    if not result then return true end
    return (result.Position - to).Magnitude < 3
end

local function getAimPart(char)
    local name = S.AimPart
    local p = char:FindFirstChild(name)
    if p and p:IsA("BasePart") then return p end
    return char:FindFirstChild("Head")
        or char:FindFirstChild("HumanoidRootPart")
        or char:FindFirstChild("UpperTorso")
end

local function getTarget()
    local best, bestDist = nil, S.FOV
    local camPos = Camera.CFrame.Position
    local viewport = Camera.ViewportSize
    local center = Vector2.new(viewport.X / 2, viewport.Y / 2)

    for _, plr in ipairs(Players:GetPlayers()) do
        if not isEnemy(plr) then continue end
        local char = plr.Character
        if not char then continue end
        local hum = char:FindFirstChildOfClass("Humanoid")
        if not hum or hum.Health <= 0 then continue end
        local part = getAimPart(char)
        if not part then continue end

        local world = part.Position
        if S.Prediction then
            local hrp = char:FindFirstChild("HumanoidRootPart")
            if hrp then
                world = world + hrp.AssemblyLinearVelocity * S.PredMult
            end
        end

        local screen, onScreen = Camera:WorldToViewportPoint(world)
        if not onScreen or screen.Z < 0 then continue end local dist2d = (Vector2.new(screen.X, screen.Y) - center).Magnitude if dist2d > S.FOV then continue end

        if S.WallCheck and not visible(camPos, world, { LocalPlayer.Character, char }) then
            continue
        end

        if dist2d < bestDist then bestDist = dist2d best = { part = part, world = world, plr = plr, screen = Vector2.new(screen.X, screen.Y) } end end return best end -- ======================== AIMBOT ======================== UserInputService.InputBegan:Connect(function(input, gp) if gp then return end if input.UserInputType == S.AimKey then HoldingAim = true end if input.KeyCode == Enum.KeyCode.Space and S.InfiniteJump then local hum = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid") if hum then hum:ChangeState(Enum.HumanoidStateType.Jumping) end end end) UserInputService.InputEnded:Connect(function(input) if input.UserInputType == S.AimKey then HoldingAim = false end end) RunService.RenderStepped:Connect(function() FOVCircle.Position = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2) FOVCircle.Radius = S.FOV FOVCircle.Visible = S.Aimbot and S.ShowFOV -- LED Discord bar — small, soft pulse, bottom center if S.DiscordLED then local vp = Camera.ViewportSize local cx = vp.X / 2 local by = vp.Y - 18 local pulse = 0.82 + 0.18 * math.sin(tick() * 2.1) DiscordLEDText.Position = Vector2.new(cx, by) DiscordLEDText.Color = S.DiscordLEDColor DiscordLEDText.Visible = true DiscordLEDGlow.Position = Vector2.new(cx, by) DiscordLEDGlow.Color = S.DiscordLEDColor DiscordLEDGlow.Transparency = 0.55 + (1 - pulse) * 0.3 DiscordLEDGlow.Visible = true DiscordLEDLine.From = Vector2.new(cx - 78, by + 11) DiscordLEDLine.To = Vector2.new(cx + 78, by + 11) DiscordLEDLine.Color = S.DiscordLEDColor DiscordLEDLine.Transparency = 0.5 + (1 - pulse) * 0.25 DiscordLEDLine.Visible = true else DiscordLEDText.Visible = false DiscordLEDGlow.Visible = false DiscordLEDLine.Visible = false end if S.Aimbot and (S.AlwaysOn or HoldingAim or S.SilentAim) then local t = getTarget() if t then local smooth = math.clamp(S.Smoothness, 0.03, 0.5) local cam = Camera.CFrame local goal = CFrame.new(cam.Position, t.world) Camera.CFrame = cam:Lerp(goal, 1 - smooth) end end -- Fly if S.Fly and flyBV and flyBG then local dir = Vector3.zero if UserInputService:IsKeyDown(Enum.KeyCode.W) then dir += Camera.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.S) then dir -= Camera.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.A) then dir -= Camera.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.D) then dir += Camera.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.Space) then dir += Vector3.yAxis end if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then dir -= Vector3.yAxis end if dir.Magnitude > 0 then dir = dir.Unit * S.FlySpeed end
        flyBV.Velocity = dir
        flyBG.CFrame = Camera.CFrame
    end
end)

-- ======================== NOCLIP ========================
RunService.Stepped:Connect(function()
    if not S.Noclip then return end
    local char = LocalPlayer.Character
    if not char then return end
    for _, part in ipairs(char:GetDescendants()) do
        if part:IsA("BasePart") then
            part.CanCollide = false
        end
    end
end)

-- ======================== ESP ========================
local BONES = {
    {"Head", "UpperTorso"},
    {"UpperTorso", "LowerTorso"},
    {"UpperTorso", "LeftUpperArm"},
    {"LeftUpperArm", "LeftLowerArm"},
    {"LeftLowerArm", "LeftHand"},
    {"UpperTorso", "RightUpperArm"},
    {"RightUpperArm", "RightLowerArm"},
    {"RightLowerArm", "RightHand"},
    {"LowerTorso", "LeftUpperLeg"},
    {"LeftUpperLeg", "LeftLowerLeg"},
    {"LeftLowerLeg", "LeftFoot"},
    {"LowerTorso", "RightUpperLeg"},
    {"RightUpperLeg", "RightLowerLeg"},
    {"RightLowerLeg", "RightFoot"},
}

local function makeESP(plr)
    if espCache[plr] then return espCache[plr] end
    local o = {
        box = Drawing.new("Square"),
        tracer = Drawing.new("Line"),
        name = Drawing.new("Text"),
        hp = Drawing.new("Line"),
        skel = {},
    }
    o.box.Thickness = 1.2
    o.box.Filled = false
    o.box.Visible = false
    o.tracer.Thickness = 1.1
    o.tracer.Visible = false
    o.name.Size = 14
    o.name.Center = true
    o.name.Outline = true
    o.name.Visible = false
    o.hp.Thickness = 2
    o.hp.Visible = false
    for i = 1, #BONES do
        local line = Drawing.new("Line")
        line.Thickness = 1.2
        line.Visible = false
        o.skel[i] = line
    end
    espCache[plr] = o
    return o
end

local function hideESP(o)
    o.box.Visible = false
    o.tracer.Visible = false
    o.name.Visible = false
    o.hp.Visible = false
    for _, l in ipairs(o.skel) do l.Visible = false end
end

local function updateESP()
    if not S.ESP then
        for _, o in pairs(espCache) do hideESP(o) end
        return
    end
    local camPos = Camera.CFrame.Position
    local vp = Camera.ViewportSize

    for _, plr in ipairs(Players:GetPlayers()) do
        if plr == LocalPlayer then continue end
        local o = makeESP(plr)
        local char = plr.Character
        local hum = char and char:FindFirstChildOfClass("Humanoid")
        local hrp = char and char:FindFirstChild("HumanoidRootPart")
        local head = char and char:FindFirstChild("Head")

        if not char or not hum or not hrp or hum.Health <= 0 then hideESP(o) continue end if S.ESPTeamCheck and LocalPlayer.Team and plr.Team and LocalPlayer.Team == plr.Team then hideESP(o) continue end local dist = (hrp.Position - camPos).Magnitude if dist > S.MaxDist then
            hideESP(o)
            continue
        end

        local top = head and head.Position + Vector3.new(0, 0.6, 0) or hrp.Position + Vector3.new(0, 2.5, 0)
        local bottom = hrp.Position - Vector3.new(0, 3, 0)
        local spTop, on1 = Camera:WorldToViewportPoint(top)
        local spBot, on2 = Camera:WorldToViewportPoint(bottom)
        if not on1 and not on2 then
            hideESP(o)
            continue
        end

        local h = math.abs(spTop.Y - spBot.Y)
        local w = h / 2
        local cx = (spTop.X + spBot.X) / 2
        local y1 = math.min(spTop.Y, spBot.Y)

        if S.Box then
            o.box.Size = Vector2.new(w, h)
            o.box.Position = Vector2.new(cx - w / 2, y1)
            o.box.Color = S.BoxColor
            o.box.Visible = true
        else
            o.box.Visible = false
        end

        if S.Tracer then
            o.tracer.From = Vector2.new(vp.X / 2, vp.Y)
            o.tracer.To = Vector2.new(cx, spBot.Y)
            o.tracer.Color = S.TracerColor
            o.tracer.Visible = true
        else
            o.tracer.Visible = false
        end

        if S.Name or S.Distance then
            local label = ""
            if S.Name then label = plr.DisplayName ~= "" and plr.DisplayName or plr.Name end
            if S.Distance then label = label .. string.format("  [%.0fm]", dist) end
            o.name.Text = label
            o.name.Position = Vector2.new(cx, y1 - 16)
            o.name.Color = S.NameColor
            o.name.Visible = true
        else
            o.name.Visible = false
        end

        if S.Health then
            local pct = math.clamp(hum.Health / math.max(hum.MaxHealth, 1), 0, 1)
            local barH = h * pct
            o.hp.From = Vector2.new(cx - w / 2 - 4, y1 + h)
            o.hp.To = Vector2.new(cx - w / 2 - 4, y1 + h - barH)
            o.hp.Color = Color3.fromRGB(255 * (1 - pct), 255 * pct, 60)
            o.hp.Visible = true
        else
            o.hp.Visible = false
        end

        if S.Skeleton then
            for i, pair in ipairs(BONES) do
                local a = char:FindFirstChild(pair[1])
                local b = char:FindFirstChild(pair[2])
                local line = o.skel[i]
                if a and b and a:IsA("BasePart") and b:IsA("BasePart") then
                    local sa, oa = Camera:WorldToViewportPoint(a.Position)
                    local sb, ob = Camera:WorldToViewportPoint(b.Position)
                    if oa and ob and sa.Z > 0 and sb.Z > 0 then
                        line.From = Vector2.new(sa.X, sa.Y)
                        line.To = Vector2.new(sb.X, sb.Y)
                        line.Color = S.SkelColor
                        line.Visible = true
                    else
                        line.Visible = false
                    end
                else
                    line.Visible = false
                end
            end
        else
            for _, l in ipairs(o.skel) do l.Visible = false end
        end
    end
end

RunService.RenderStepped:Connect(updateESP)

Players.PlayerRemoving:Connect(function(plr)
    local o = espCache[plr]
    if o then
        hideESP(o)
        for _, d in pairs(o) do
            if typeof(d) == "table" then
                for _, x in pairs(d) do pcall(function() x:Remove() end) end
            else
                pcall(function() d:Remove() end)
            end
        end
        espCache[plr] = nil
    end
end)

-- ======================== BULLET TRACERS ========================
local function spawnBullet(origin, endPos)
    local line = Drawing.new("Line")
    line.Thickness = S.BulletThick
    line.Color = S.BulletColor
    line.Visible = true
    local t0 = tick()
    table.insert(bullets, { line = line, origin = origin, endPos = endPos, t0 = t0 })
end

local function updateBullets()
    local now = tick()
    for i = #bullets, 1, -1 do
        local b = bullets[i]
        local age = now - b.t0
        if age > S.BulletLife then
            b.line:Remove()
            table.remove(bullets, i)
        else
            local s1, o1 = Camera:WorldToViewportPoint(b.origin)
            local s2, o2 = Camera:WorldToViewportPoint(b.endPos)
            if o1 or o2 then
                b.line.From = Vector2.new(s1.X, s1.Y)
                b.line.To = Vector2.new(s2.X, s2.Y)
                b.line.Transparency = 1 - (age / S.BulletLife)
                b.line.Visible = true
            else
                b.line.Visible = false
            end
        end
    end
end
RunService.RenderStepped:Connect(updateBullets)

local function fireTracer()
    if not S.BulletTracer then return end
    if tick() - lastShot < 0.05 then return end
    lastShot = tick()
    local origin = Camera.CFrame.Position
    local char = LocalPlayer.Character
    if char then
        local tool = char:FindFirstChildOfClass("Tool")
        if tool then
            local handle = tool:FindFirstChild("Handle") or tool:FindFirstChildWhichIsA("BasePart")
            if handle then origin = handle.Position end
        end
    end
    local dir = Camera.CFrame.LookVector
    local endPos = origin + dir * S.BulletMaxDist
    local params = RaycastParams.new()
    params.FilterType = Enum.RaycastFilterType.Exclude
    params.FilterDescendantsInstances = { LocalPlayer.Character }
    local hit = Workspace:Raycast(origin, dir * S.BulletMaxDist, params)
    if hit then endPos = hit.Position end
    spawnBullet(origin, endPos)
end

UserInputService.InputBegan:Connect(function(input, gp)
    if gp then return end
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        fireTracer()
    end
end)

local function hookTool(tool)
    if not tool or not tool:IsA("Tool") then return end
    tool.Activated:Connect(function()
        fireTracer()
    end)
end

local function setupChar(char)
    if not char then return end
    for _, c in ipairs(char:GetChildren()) do
        if c:IsA("Tool") then hookTool(c) end
    end
    char.ChildAdded:Connect(function(c)
        if c:IsA("Tool") then hookTool(c) end
    end)
    if S.Speed then
        local hum = char:FindFirstChildOfClass("Humanoid")
        if hum then hum.WalkSpeed = S.WalkSpeed end
    end
end

if LocalPlayer.Character then setupChar(LocalPlayer.Character) end
LocalPlayer.CharacterAdded:Connect(setupChar)

-- Auto re-attach camera ref after respawn
if S.AutoReattach then
    LocalPlayer.CharacterAdded:Connect(function()
        task.wait(0.5)
        Camera = Workspace.CurrentCamera
    end)
end

Rayfield:Notify({
    Title = "ELITE SCRIPTS",
    Content = "Loaded for Rivals. INSERT / menu key in Rayfield.",
    Duration = 5
})

print("[ELITE SCRIPTS] Rivals script loaded")

Leave a Comment

Your email address will not be published. Required fields are marked *