-- [[ EzKat - Rayfield Script (Educational Lua/Luau Template) ]] -- Ghi chú: Script by t.linh097 in discord... -- 1. Khởi tạo thư viện Rayfield local Rayfield = loadstring(game:HttpGet("https://sirius.menu/rayfield"))() local Window = Rayfield:CreateWindow({ Name = "EzKat", Icon = 0, LoadingTitle = "EzKat Loader", LoadingSubtitle = "by t.linh097 in discord...", Theme = "Default", DisableRayfieldPrompts = false, DisableBuildWarnings = false, ConfigurationSaving = { Enabled = true, FolderName = "EzKatConfig", FileName = "EzKatSave" }, Discord = { Enabled = false, Invite = "noinvitelink", RememberJoins = true }, KeySystem = false }) -- 2. Dịch vụ & biến toàn cục local Players = game:GetService("Players") local RunService = game:GetService("RunService") local Lighting = game:GetService("Lighting") local Workspace = game:GetService("Workspace") local LocalPlayer = Players.LocalPlayer local Camera = Workspace.CurrentCamera -- Trạng thái chức năng local State = { RingOb = false, RingRadius = 15, RingAngle = 0, LockedRingTarget = nil, SilentAim = false, LockedAimTarget = nil, EspEnabled = false, Fullbright = false, NoFog = false, AntiRagdoll = false, WalkSpeed = 16, SpeedEnabled = false, Noclip = false } -- Lưu giá trị ánh sáng gốc để khôi phục khi tắt local OriginalLighting = { Ambient = Lighting.Ambient, OutdoorAmbient = Lighting.OutdoorAmbient, Brightness = Lighting.Brightness, GlobalShadows = Lighting.GlobalShadows, FogEnd = Lighting.FogEnd, FogStart = Lighting.FogStart } -- 3. Hàm hỗ trợ nhân vật & mục tiêu local function getCharacter(player) return player and player.Character end local function getHumanoid(player) local char = getCharacter(player) return char and char:FindFirstChildOfClass("Humanoid") end local function getRootPart(player) local char = getCharacter(player) return char and char:FindFirstChild("HumanoidRootPart") end local function isAlive(player) local hum = getHumanoid(player) local root = getRootPart(player) return hum and root and hum.Health > 0 end -- Tìm người chơi gần nhân vật LocalPlayer nhất local function getClosestPlayer() local myRoot = getRootPart(LocalPlayer) if not myRoot then return nil end local closest = nil local shortestDist = math.huge for _, plr in ipairs(Players:GetPlayers()) do if plr ~= LocalPlayer and isAlive(plr) then local root = getRootPart(plr) local dist = (root.Position - myRoot.Position).Magnitude if dist < shortestDist then shortestDist = dist closest = plr end end end return closest end -- Kiểm tra mục tiêu bị khóa còn hợp lệ không (còn trong game và còn sống) local function isTargetValid(target) if not target or not target.Parent then return false end if not Players:FindFirstChild(target.Name) then return false end return isAlive(target) end -- 4. Hệ thống ESP (Drawing API: Line + Box + Thanh HP dọc) local EspObjects = {} local function createEspForPlayer(player) if player == LocalPlayer or EspObjects[player] then return end local tracer = Drawing.new("Line") tracer.Visible = false tracer.Thickness = 1.5 tracer.Color = Color3.fromRGB(255, 80, 80) local box = Drawing.new("Square") box.Visible = false box.Thickness = 1.5 box.Filled = false box.Color = Color3.fromRGB(255, 255, 255) local hpOutline = Drawing.new("Square") hpOutline.Visible = false hpOutline.Thickness = 1 hpOutline.Filled = false hpOutline.Color = Color3.fromRGB(0, 0, 0) local hpBar = Drawing.new("Square") hpBar.Visible = false hpBar.Thickness = 1 hpBar.Filled = true hpBar.Color = Color3.fromRGB(0, 255, 100) EspObjects[player] = { Tracer = tracer, Box = box, HpOutline = hpOutline, HpBar = hpBar } end local function hideEspItem(item) if not item then return end item.Tracer.Visible = false item.Box.Visible = false item.HpOutline.Visible = false item.HpBar.Visible = false end local function removeEspForPlayer(player) local item = EspObjects[player] if item then item.Tracer:Remove() item.Box:Remove() item.HpOutline:Remove() item.HpBar:Remove() EspObjects[player] = nil end end for _, plr in ipairs(Players:GetPlayers()) do if plr ~= LocalPlayer then createEspForPlayer(plr) end end Players.PlayerAdded:Connect(function(plr) createEspForPlayer(plr) end) Players.PlayerRemoving:Connect(function(plr) removeEspForPlayer(plr) end) local function updateEsp() if not State.EspEnabled then for _, item in pairs(EspObjects) do hideEspItem(item) end return end local topCenter = Vector2.new(Camera.ViewportSize.X / 2, 0) for plr, item in pairs(EspObjects) do local char = getCharacter(plr) local hum = getHumanoid(plr) local root = getRootPart(plr) if char and hum and root and hum.Health > 0 then local rootPos, onScreen = Camera:WorldToViewportPoint(root.Position) if onScreen and rootPos.Z > 0 then local head = char:FindFirstChild("Head") local headWorld = head and (head.Position + Vector3.new(0, 0.6, 0)) or (root.Position + Vector3.new(0, 3, 0)) local feetWorld = root.Position - Vector3.new(0, 3.2, 0) local topScreen = Camera:WorldToViewportPoint(headWorld) local bottomScreen = Camera:WorldToViewportPoint(feetWorld) local boxHeight = math.max(12, math.abs(bottomScreen.Y - topScreen.Y)) local boxWidth = boxHeight * 0.58 local boxX = rootPos.X - (boxWidth / 2) local boxY = topScreen.Y -- Line từ trên cùng giữa màn hình dẫn tới Box item.Tracer.From = topCenter item.Tracer.To = Vector2.new(rootPos.X, boxY) item.Tracer.Visible = true -- Box bao quanh mục tiêu item.Box.Size = Vector2.new(boxWidth, boxHeight) item.Box.Position = Vector2.new(boxX, boxY) item.Box.Visible = true -- Thanh HP dọc bên cạnh trái Box local hpRatio = math.clamp(hum.Health / math.max(1, hum.MaxHealth), 0, 1) local barWidth = 4 local barX = boxX - barWidth - 4 item.HpOutline.Size = Vector2.new(barWidth, boxHeight) item.HpOutline.Position = Vector2.new(barX, boxY) item.HpOutline.Visible = true local fillHeight = boxHeight * hpRatio item.HpBar.Size = Vector2.new(math.max(1, barWidth - 2), math.max(1, fillHeight)) item.HpBar.Position = Vector2.new(barX + 1, boxY + (boxHeight - fillHeight)) item.HpBar.Color = Color3.fromRGB(255 * (1 - hpRatio), 255 * hpRatio, 60) item.HpBar.Visible = true else hideEspItem(item) end else hideEspItem(item) end end end -- 5. Hệ thống Fullbright & NoFog local function applyLighting() if State.Fullbright then Lighting.Ambient = Color3.new(1, 1, 1) Lighting.OutdoorAmbient = Color3.new(1, 1, 1) Lighting.Brightness = 2 Lighting.GlobalShadows = false else Lighting.Ambient = OriginalLighting.Ambient Lighting.OutdoorAmbient = OriginalLighting.OutdoorAmbient Lighting.Brightness = OriginalLighting.Brightness Lighting.GlobalShadows = OriginalLighting.GlobalShadows end if State.NoFog then Lighting.FogEnd = 1e6 Lighting.FogStart = 1e6 for _, obj in ipairs(Lighting:GetChildren()) do if obj:IsA("Atmosphere") then obj.Density = 0 end end else Lighting.FogEnd = OriginalLighting.FogEnd Lighting.FogStart = OriginalLighting.FogStart end end -- 6. Hệ thống Moveset (AntiRagdoll, Speed, Noclip) local function updateMoveset() local char = getCharacter(LocalPlayer) local hum = getHumanoid(LocalPlayer) local root = getRootPart(LocalPlayer) if State.AntiRagdoll and hum then -- Khôi phục trạng thái đứng thẳng nếu bị ragdoll / platform stand / physics if hum.PlatformStand then hum.PlatformStand = false end if hum:GetState() == Enum.HumanoidStateType.Ragdoll or hum:GetState() == Enum.HumanoidStateType.FallingDown then hum:ChangeState(Enum.HumanoidStateType.GettingUp) end -- Giảm hiệu ứng slow phổ biến bằng cách giữ WalkSpeed tối thiểu khi đang bật Speed if root then for _, part in ipairs(char:GetDescendants()) do if part:IsA("BodyVelocity") or part:IsA("BodyPosition") or part:IsA("AngularVelocity") then part:Destroy() end end end end if hum then if State.SpeedEnabled then hum.WalkSpeed = State.WalkSpeed end end if State.Noclip and char then for _, part in ipairs(char:GetDescendants()) do if part:IsA("BasePart") then part.CanCollide = false end end end end -- 7. Vòng lặp chính Combat (RingOb & SilentAim) + Visual + Moveset RunService.RenderStepped:Connect(function(dt) updateEsp() local myRoot = getRootPart(LocalPlayer) local myHum = getHumanoid(LocalPlayer) -- RingOb: Bay vòng quanh mục tiêu gần nhất, luôn hướng mặt vào mục tiêu, khóa tới khi chết hoặc Off if State.RingOb then if not isTargetValid(State.LockedRingTarget) then State.LockedRingTarget = getClosestPlayer() end if isTargetValid(State.LockedRingTarget) and myRoot then local targetRoot = getRootPart(State.LockedRingTarget) State.RingAngle = (State.RingAngle + dt * 3.5) % (math.pi * 2) local offset = Vector3.new( math.cos(State.RingAngle) * State.RingRadius, 0, math.sin(State.RingAngle) * State.RingRadius ) local desiredPos = targetRoot.Position + offset local lookAtTarget = CFrame.lookAt(desiredPos, Vector3.new(targetRoot.Position.X, desiredPos.Y, targetRoot.Position.Z)) myRoot.CFrame = lookAtTarget myRoot.AssemblyLinearVelocity = Vector3.zero end else State.LockedRingTarget = nil end -- SilentAim: Hướng nhân vật vào mục tiêu gần nhất, khóa tới khi mục tiêu chết hoặc Off if State.SilentAim then if not isTargetValid(State.LockedAimTarget) then State.LockedAimTarget = getClosestPlayer() end if isTargetValid(State.LockedAimTarget) and myRoot then local targetRoot = getRootPart(State.LockedAimTarget) local flatTargetPos = Vector3.new(targetRoot.Position.X, myRoot.Position.Y, targetRoot.Position.Z) myRoot.CFrame = CFrame.lookAt(myRoot.Position, flatTargetPos) end else State.LockedAimTarget = nil end -- Đảm bảo WalkSpeed luôn được áp dụng nếu bật Speed if State.SpeedEnabled and myHum and myHum.WalkSpeed ~= State.WalkSpeed then myHum.WalkSpeed = State.WalkSpeed end end) RunService.Stepped:Connect(function() updateMoveset() end) -- 8. Tạo các Tab trong Rayfield local CombatTab = Window:CreateTab("Combat", 4483362458) local VisuelTab = Window:CreateTab("Visuel", 4483362458) local MovesetTab = Window:CreateTab("Moveset", 4483362458) local CreditsTab = Window:CreateTab("Credits", 4483362458) -- --- TAB COMBAT --- CombatTab:CreateToggle({ Name = "RingOb", CurrentValue = false, Flag = "RingObToggle", Callback = function(Value) State.RingOb = Value if not Value then State.LockedRingTarget = nil end end }) CombatTab:CreateSlider({ Name = "RingOb Distance", Range = {0, 50}, Increment = 1, Suffix = " studs", CurrentValue = 15, Flag = "RingObDistanceSlider", Callback = function(Value) State.RingRadius = Value end }) CombatTab:CreateToggle({ Name = "SilentAim", CurrentValue = false, Flag = "SilentAimToggle", Callback = function(Value) State.SilentAim = Value if not Value then State.LockedAimTarget = nil end end }) -- --- TAB VISUEL --- VisuelTab:CreateToggle({ Name = "Esp", CurrentValue = false, Flag = "EspToggle", Callback = function(Value) State.EspEnabled = Value end }) VisuelTab:CreateToggle({ Name = "Fullbright", CurrentValue = false, Flag = "FullbrightToggle", Callback = function(Value) State.Fullbright = Value applyLighting() end }) VisuelTab:CreateToggle({ Name = "Nofog", CurrentValue = false, Flag = "NofogToggle", Callback = function(Value) State.NoFog = Value applyLighting() end }) -- --- TAB MOVESET --- MovesetTab:CreateToggle({ Name = "AntiRagdoll", CurrentValue = false, Flag = "AntiRagdollToggle", Callback = function(Value) State.AntiRagdoll = Value end }) MovesetTab:CreateSlider({ Name = "Speed", Range = {0, 500}, Increment = 1, Suffix = " WalkSpeed", CurrentValue = 16, Flag = "SpeedSlider", Callback = function(Value) State.WalkSpeed = Value State.SpeedEnabled = Value > 16 local hum = getHumanoid(LocalPlayer) if hum then hum.WalkSpeed = Value end end }) MovesetTab:CreateToggle({ Name = "Noclip", CurrentValue = false, Flag = "NoclipToggle", Callback = function(Value) State.Noclip = Value end }) -- --- TAB CREDITS --- CreditsTab:CreateSection("EzKat Credits") CreditsTab:CreateLabel("Script Name: EzKat") CreditsTab:CreateLabel("UI Library: Rayfield") CreditsTab:CreateLabel("Ghi chú: Script by t.linh097 in discord...")