local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
local Camera = Workspace.CurrentCamera
--------------------------------------------------
-- SETTINGS
--------------------------------------------------
local espEnabled = false
local aimEnabled = false
local autoShootEnabled = false
local rainbowESP = false
local clickAim = false
local triggerBot = false
local espColor = Color3.fromRGB(255, 0, 0)
local rainbowSpeed = 0.02
local smoothness = 0.15
local maxDistance = 150
local aimPart = "Head"
local shootDelay = 0.1
local triggerBotDelay = 0.05
local espObjects = {}
local lastShotTime = 0
local lastTriggerTime = 0
--------------------------------------------------
-- UI WINDOW
--------------------------------------------------
local Window = Rayfield:CreateWindow({
Name = "Cool Studios",
Icon = 11767039004,
LoadingTitle = "Cool Studios",
LoadingSubtitle = "System Loading...",
Theme = "Amber",
ToggleUIKeybind = "K",
})
local ESPTab = Window:CreateTab("ESP", 11767039004)
local AimTab = Window:CreateTab("Aim Assist", 11767039004)
--------------------------------------------------
-- RAINBOW
--------------------------------------------------
local function getRainbowColor()
return Color3.fromHSV(tick() * rainbowSpeed % 1, 1, 1)
end
--------------------------------------------------
-- VISIBILITY CHECK (🔥 WALL CHECK)
--------------------------------------------------
local function isVisible(targetPart)
if not targetPart or not player.Character then return false
local origin = Camera.CFrame.Position
local direction = (targetPart.Position - origin).Unit * maxDistance
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {player.Character}
params.IgnoreWater = true
local result = Workspace:Raycast(origin, direction, params)
if result and result.Instance then
-- Check if the hit part belongs to the target player
local hitPlayer = Players:GetPlayerFromCharacter(result.Instance.Parent)
if hitPlayer and hitPlayer == Players:GetPlayerFromCharacter(targetPart.Parent) then
return true
end
return false
end
return true
end
--------------------------------------------------
-- ESP UI
--------------------------------------------------
ESPTab:CreateToggle({
Name = "Enable ESP",
Callback = function(Value)
espEnabled = Value
if not Value then
for _, obj in pairs(espObjects) do
if obj then obj:Destroy() end
end
espObjects = {}
end
end,
})
ESPTab:CreateToggle({
Name = "Rainbow ESP",
Callback = function(Value)
rainbowESP = Value
end,
})
ESPTab:CreateColorPicker({
Name = "ESP Color",
Color = espColor,
Callback = function(Value)
espColor = Value
end,
})
--------------------------------------------------
-- AIM UI
--------------------------------------------------
AimTab:CreateToggle({
Name = "Enable Aim Assist",
Callback = function(Value)
aimEnabled = Value
end,
})
AimTab:CreateToggle({
Name = "Only While Clicking",
Callback = function(Value)
clickAim = Value
end,
})
AimTab:CreateToggle({
Name = "Auto Shoot",
Callback = function(Value)
autoShootEnabled = Value
end,
})
AimTab:CreateToggle({
Name = "Trigger Bot",
Callback = function(Value)
triggerBot = Value
end,
})
AimTab:CreateSlider({
Name = "Smoothness",
Range = {0.05, 1},
Increment = 0.05,
CurrentValue = smooth1ness,
Callback = function(Value)
smoothness = Value
end,
})
AimTab:CreateSlider({
Name = "Max Distance",
Range = {50, 300},
Increment = 10,
CurrentValue = maxDistance,
Callback = function(Value)
maxDistance = Value
end,
})
AimTab:CreateSlider({
Name = "Shoot Delay",
Range = {0.05, 0.5},
Increment = 0.05,
CurrentValue = shootDelay,
Callback = function(Value)
shootDelay = Value
end,
})
AimTab:CreateSlider({
Name = "TriggerBot Delay",
Range = {0.01, 0.2},
Increment = 0.01,
CurrentValue = triggerBotDelay,
Callback = function(Value)
triggerBotDelay = Value
end,
})
AimTab:CreateDropdown({
Name = "Aim Part",
Options = {"Head", "Torso", "HumanoidRootPart", "UpperTorso", "LowerTorso"},
CurrentOption = aimPart,
Callback = function(Value)
aimPart = Value
end,
})
--------------------------------------------------
-- ESP SYSTEM
--------------------------------------------------
local function applyESP(plr)
if plr == player then return end
if not plr.Character then return end
if espObjects[plr] then
espObjects[plr]:Destroy()
espObjects[plr] = nil
end
local h = Instance.new("Highlight")
if rainbowESP then
local c = getRainbowColor()
h.FillColor = c
h.OutlineColor = c
else
h.FillColor = espColor
h.OutlineColor = espColor
end
h.FillTransparency = 0.5
h.OutlineTransparency = 0
h.Adornee = plr.Character
h.Parent = plr.Character
espObjects[plr] = h
end
--------------------------------------------------
-- AIM SYSTEM (🔥 WITH WALL CHECK)
--------------------------------------------------
local function getClosestTarget()
if not player.Character then return nil, nil end
local root = player.Character:FindFirstChild("HumanoidRootPart")
if not root then return nil, nil end
local closestPlayer = nil
local closestPart = nil
local shortest = math.huge
for _, p in ipairs(Players:GetPlayers()) do
if p ~= player and p.Character then
local targetRoot = p.Character:FindFirstChild("HumanoidRootPart")
local targetAimPart = p.Character:FindFirstChild(aimPart)
if targetRoot and targetAimPart then
local dist = (root.Position - targetRoot.Position).Magnitude
-- DISTANCE + WALL CHECK
if dist <= maxDistance and isVisible(targetAimPart) then
if dist < shortest then
shortest = dist
closestPlayer = p
closestPart = targetAimPart
end
end
end
end
end
return closestPlayer, closestPart
end
--------------------------------------------------
-- AUTO SHOOT SYSTEM
--------------------------------------------------
local function autoShoot(targetPlayer, targetPart)
if not autoShootEnabled or not targetPlayer or not targetPart then return end
local currentTime = tick()
if currentTime - lastShotTime < shootDelay then return end
-- Mouse click simulation for shooting
mouse1press()
task.wait(0.05)
mouse1release()
lastShotTime = currentTime
-- Try different attack methods for Rivals
local character = player.Character
if character then
-- Try to find a tool/weapon
local Tool = character:FindFirstChildOfClass("Tool")
if Tool then
-- RemoteEvent-based weapons
local remoteEvent = Tool:FindFirstChild("RemoteEvent") or Tool:FindFirstChild("Fire") or Tool:FindFirstChild("Attack")
if remoteEvent then
remoteEvent:FireServer("Fire", targetPart.Position)
return
end
-- RemoteFunction-based weapons
local remoteFunction = Tool:FindFirstChild("RemoteFunction") or Tool:FindFirstChild("FireFunction")
if remoteFunction then
remoteFunction:InvokeServer("Fire", targetPart.Position)
return
end
-- Standard Attack (Tool Activate)
Tool:Activate()
end
-- Direct damage fallback (if no tool found)
if targetPlayer.Character and targetPlayer.Character:FindFirstChild("Humanoid") then
local humanoid = targetPlayer.Character.Humanoid
if humanoid.Health > 0 then
humanoid:TakeDamage(35)
end
end
end
end
--------------------------------------------------
-- TRIGGER BOT SYSTEM (FIXED)
--------------------------------------------------
local function triggerBotCheck()
if not triggerBot then return end
local currentTime = tick()
if currentTime - lastTriggerTime < triggerBotDelay then return end
-- More accurate raycast for TriggerBot
local rayOrigin = Camera.CFrame.Position
local rayDirection = Camera.CFrame.LookVector * maxDistance
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
if player.Character then
raycastParams.FilterDescendantsInstances = {player.Character}
else
raycastParams.FilterDescendantsInstances = {}
end
raycastParams.IgnoreWater = true
local rayResult = Workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if rayResult and rayResult.Instance then
local hitPart = rayResult.Instance
local hitModel = hitPart.Parent
-- Check if we hit a player character
for _, p in ipairs(Players:GetPlayers()) do
if p ~= player and p.Character and hitModel == p.Character or hitModel:IsDescendantOf(p.Character) then
-- Auto-Shoot when aiming at enemy
mouse1press()
task.wait(0.05)
mouse1release()
lastTriggerTime = currentTime
lastShotTime = currentTime
-- Attack methods
if player.Character then
local Tool = player.Character:FindFirstChildOfClass("Tool")
if Tool then
Tool:Activate()
end
end
return true -- Found target, stop checking
end
end
end
return false -- No target found
end
--------------------------------------------------
-- AIM LOOP (OPTIMIZED)
--------------------------------------------------
RunService.RenderStepped:Connect(function()
-- TriggerBot Check (independent from aimEnabled)
triggerBotCheck()
if not aimEnabled then return end
-- CLICK CHECK (only for Aim Assist, not for TriggerBot)
if clickAim and not UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
return
end
local targetPlayer, targetPart = getClosestTarget()
if not targetPart then return end
-- Smooth aiming with lerp
local camPos = Camera.CFrame.Position
-- Calculate target position with slight offset for headshots
local targetPos = targetPart.Position
if aimPart == "Head" then
targetPos = targetPos + Vector3.new(0, 0.5, 0) -- Small offset for better head aiming
end
local goal = CFrame.new(camPos, targetPos)
Camera.CFrame = Camera.CFrame:Lerp(goal, smoothness)
-- Auto-Shoot after aiming (only if not already shooting from TriggerBot)
if autoShootEnabled and tick() - lastShotTime >= shootDelay then
autoShoot(targetPlayer, targetPart)
end
end)
--------------------------------------------------
-- ESP LOOP (OPTIMIZED)
--------------------------------------------------
task.spawn(function()
while true do
task.wait(0.2) -- Reduced frequency for better performance
if espEnabled then
for _, plr in ipairs(Players:GetPlayers()) do
if plr ~= player then
if plr.Character and plr.Character:FindFirstChild("Humanoid") then
applyESP(plr)
else
-- Remove ESP if player has no character
if espObjects[plr] then
espObjects[plr]:Destroy()
espObjects[plr] = nil
end
end
end
end
else
-- Clear all ESP when disabled
for plr, obj in pairs(espObjects) do
if obj then
obj:Destroy()
espObjects[plr] = nil
end
end
end
-- Update rainbow ESP color if enabled
if rainbowESP and espEnabled then
for plr, obj in pairs(espObjects) do
if obj and plr.Character then
local c = getRainbowColor()
obj.FillColor = c
obj.OutlineColor = c
end
end
end
end
end)
print("Rivals Combat Script mit Rayfield UI geladen!")
print("Stabiler TriggerBot, Auto-Shoot, Aim Assist und ESP aktiviert")
print("TriggerBot Delay: " .. triggerBotDelay .. " Sekunden")