local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local player = Players.LocalPlayer
local Camera = workspace.CurrentCamera
--------------------------------------------------
-- SETTINGS
--------------------------------------------------
local espEnabled = false
local aimEnabled = false
local rainbowESP = false
local clickAim = false
local espColor = Color3.fromRGB(255, 0, 0)
local rainbowSpeed = 0.02
local smoothness = 0.15
local maxDistance = 150
local espObjects = {}
--------------------------------------------------
-- 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)
local origin = Camera.CFrame.Position
local direction = (targetPart.Position - origin)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {player.Character}
local result = workspace:Raycast(origin, direction, params)
if result and result.Instance then
return result.Instance:IsDescendantOf(targetPart.Parent)
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", -- 🔥 NEW
Callback = function(Value)
clickAim = Value
end,
})
AimTab:CreateSlider({
Name = "Smoothness",
Range = {0.05, 1},
Increment = 0.05,
CurrentValue = smoothness,
Callback = function(Value)
smoothness = Value
end,
})
AimTab:CreateSlider({
Name = "Max Distance",
Range = {50, 300},
Increment = 10,
CurrentValue = maxDistance,
Callback = function(Value)
maxDistance = 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()
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 end
local root = player.Character:FindFirstChild("HumanoidRootPart")
if not root then return nil end
local closest
local shortest = math.huge
for _, p in ipairs(Players:GetPlayers()) do
if p ~= player and p.Character then
local targetRoot = p.Character:FindFirstChild("HumanoidRootPart")
if targetRoot then
local dist = (root.Position - targetRoot.Position).Magnitude
-- 🔥 DISTANCE + WALL CHECK
if dist <= maxDistance and isVisible(targetRoot) then
if dist < shortest then
shortest = dist
closest = targetRoot
end
end
end
end
end
return closest
end
--------------------------------------------------
-- AIM LOOP
--------------------------------------------------
RunService.RenderStepped:Connect(function()
if not aimEnabled then return end
-- 🔥 CLICK CHECK
if clickAim and not UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
return
end
local target = getClosestTarget()
if not target then return end
local camPos = Camera.CFrame.Position
local goal = CFrame.new(camPos, target.Position)
Camera.CFrame = Camera.CFrame:Lerp(goal, smoothness)
end)
--------------------------------------------------
-- ESP LOOP
--------------------------------------------------
task.spawn(function()
while true do
task.wait(0.1)
if espEnabled then
for _, plr in ipairs(Players:GetPlayers()) do
if plr ~= player then
applyESP(plr)
end
end
end
end
end)