khoidethuong12
Key RequiredUniversal

khoidethuong12

Universal ScriptSkidder16769Skidder16769 20 views 104 executesUpdated Aug 10, 2026
Unrated
00
Lua Script•524 lines (18737 chars)
--[[
  Starlight.RNG Script (Phiên bản Việt Hóa & Splash Screen)
  - Thêm Màn hình chào mừng (Fade out sau 2.5s)
  - Thêm nút Tự Động Nhập Tên Vũ Khí
  - Tích hợp Anti-AFK an toàn cho cả PC & Mobile
  - Việt hóa 100% giao diện
]]--

local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local VirtualInputManager = game:GetService("VirtualInputManager")
local VirtualUser = game:GetService("VirtualUser")
local TweenService = game:GetService("TweenService") -- Thêm TweenService để làm mượt hiệu ứng fade

local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

-- HỆ THỐNG ANTI-AFK (An toàn cho cả PC và Mobile)
LocalPlayer.Idled:Connect(function()
    VirtualUser:Button2Down(Vector2.new(0, 0), Workspace.CurrentCamera.CFrame)
    task.wait(1)
    VirtualUser:Button2Up(Vector2.new(0, 0), Workspace.CurrentCamera.CFrame)
end)

-- GIAO DIỆN CHÍNH (GUI)
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "StarlightRNGGui"
ScreenGui.ResetOnSpawn = false
ScreenGui.Parent = PlayerGui

---------------------------------------------------------
-- MÀN HÌNH CHÀO MỪNG (WELCOME SCREEN)
---------------------------------------------------------
local WelcomeFrame = Instance.new("Frame")
WelcomeFrame.Size = UDim2.new(1, 0, 1, 0) -- Phủ kín toàn màn hình
WelcomeFrame.Position = UDim2.new(0, 0, 0, 0)
WelcomeFrame.BackgroundColor3 = Color3.fromRGB(15, 15, 15) -- Màu nền tối để tạo độ tương phản cao
WelcomeFrame.BorderSizePixel = 0
WelcomeFrame.ZIndex = 100 -- Đảm bảo luôn nằm trên cùng
WelcomeFrame.Parent = ScreenGui

local WelcomeText = Instance.new("TextLabel")
WelcomeText.Size = UDim2.new(1, 0, 1, 0)
WelcomeText.BackgroundTransparency = 1
WelcomeText.Text = "Chào mừng, " .. LocalPlayer.DisplayName
WelcomeText.TextColor3 = Color3.fromRGB(255, 255, 255) -- Chữ trắng nổi bật
WelcomeText.Font = Enum.Font.GothamBold -- Font chữ dày, to rõ
WelcomeText.TextSize = 45 -- Kích thước chữ lớn
WelcomeText.ZIndex = 101
WelcomeText.Parent = WelcomeFrame
---------------------------------------------------------

-- Nút Ẩn/Hiện GUI (Kéo thả được) - TẠM THỜI ẨN
local ToggleBtn = Instance.new("TextButton")
ToggleBtn.Name = "ToggleGUIButton"
ToggleBtn.Size = UDim2.new(0, 90, 0, 30)
ToggleBtn.Position = UDim2.new(0, 10, 0, 10)
ToggleBtn.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
ToggleBtn.Text = "Ẩn/Hiện GUI"
ToggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleBtn.Font = Enum.Font.SourceSansBold
ToggleBtn.TextSize = 14
ToggleBtn.Active = true
ToggleBtn.Draggable = true
ToggleBtn.Visible = false -- Ẩn lúc mới vào
ToggleBtn.Parent = ScreenGui

local ToggleCorner = Instance.new("UICorner")
ToggleCorner.CornerRadius = UDim.new(0, 6)
ToggleCorner.Parent = ToggleBtn

-- Khung Main GUI - TẠM THỜI ẨN
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 320, 0, 320)
MainFrame.Position = UDim2.new(0.5, -160, 0.5, -160)
MainFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
MainFrame.BorderSizePixel = 0
MainFrame.Active = true
MainFrame.Draggable = true
MainFrame.Visible = false -- Ẩn lúc mới vào
MainFrame.Parent = ScreenGui

ToggleBtn.MouseButton1Click:Connect(function()
    MainFrame.Visible = not MainFrame.Visible
end)

local MainCorner = Instance.new("UICorner")
MainCorner.CornerRadius = UDim.new(0, 8)
MainCorner.Parent = MainFrame

-- HIỆU ỨNG CHẠY MÀN HÌNH CHÀO MỪNG
task.spawn(function()
    task.wait(2.5) -- Đợi 2.5 giây

    -- Tạo hiệu ứng mờ dần (Fade out) trong 1 giây
    local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
    local fadeFrame = TweenService:Create(WelcomeFrame, tweenInfo, {BackgroundTransparency = 1})
    local fadeText = TweenService:Create(WelcomeText, tweenInfo, {TextTransparency = 1})

    fadeFrame:Play()
    fadeText:Play()

    fadeFrame.Completed:Wait() -- Chờ hiệu ứng mờ dần kết thúc
    WelcomeFrame:Destroy() -- Xóa màn hình chào mừng để giải phóng bộ nhớ

    -- Hiển thị GUI chính
    MainFrame.Visible = true
    ToggleBtn.Visible = true
end)

local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(1, -60, 0, 30)
Title.Position = UDim2.new(0, 10, 0, 10)
Title.BackgroundTransparency = 1
Title.Text = "Starlight.RNG"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.TextSize = 20
Title.Font = Enum.Font.SourceSansBold
Title.TextXAlignment = Enum.TextXAlignment.Left
Title.Parent = MainFrame

local InfoBtn = Instance.new("TextButton")
InfoBtn.Name = "InfoButton"
InfoBtn.Size = UDim2.new(0, 28, 0, 28)
InfoBtn.Position = UDim2.new(1, -70, 0, 10)
InfoBtn.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
InfoBtn.Text = "?"
InfoBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
InfoBtn.Font = Enum.Font.SourceSansBold
InfoBtn.TextSize = 16
InfoBtn.Parent = MainFrame
Instance.new("UICorner", InfoBtn).CornerRadius = UDim.new(0, 5)

local CloseBtn = Instance.new("TextButton")
CloseBtn.Name = "CloseButton"
CloseBtn.Size = UDim2.new(0, 28, 0, 28)
CloseBtn.Position = UDim2.new(1, -38, 0, 10)
CloseBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
CloseBtn.Text = "X"
CloseBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseBtn.Font = Enum.Font.SourceSansBold
CloseBtn.TextSize = 16
CloseBtn.Parent = MainFrame
Instance.new("UICorner", CloseBtn).CornerRadius = UDim.new(0, 5)

CloseBtn.MouseButton1Click:Connect(function() 
    ScreenGui:Destroy() 
end)

-- BẢNG THÔNG TIN (INFO)
local InfoFrame = Instance.new("Frame")
InfoFrame.Name = "InfoFrame"
InfoFrame.Size = UDim2.new(0.9, 0, 0.78, 0)
InfoFrame.Position = UDim2.new(0.05, 0, 0.16, 0)
InfoFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
InfoFrame.BorderSizePixel = 0
InfoFrame.Visible = false
InfoFrame.ZIndex = 5
InfoFrame.Parent = MainFrame
Instance.new("UICorner", InfoFrame).CornerRadius = UDim.new(0, 8)

local InfoText = Instance.new("TextLabel")
InfoText.Size = UDim2.new(0.9, 0, 0.82, 0)
InfoText.Position = UDim2.new(0.05, 0, 0.05, 0)
InfoText.BackgroundTransparency = 1
InfoText.ZIndex = 6
InfoText.Text = "== THÔNG TIN STARLIGHT.RNG ==\n- Tác giả: Gans\n- Trạng thái: Hoạt động\n\n== HƯỚNG DẪN SỬ DỤNG ==\n1. Nhập chính xác tên Vũ khí 1 & 2 (hoặc bấm nút Tự Điền VK).\n2. Điều chỉnh Độ cao nếu cần thiết.\n3. Bấm 'BẮT ĐẦU AUTO FARM' để chạy.\n\n💡 MẸO: Nên đặt Độ cao là 12 hoặc -12 để đảm bảo tầm đánh tốt nhất!"
InfoText.TextColor3 = Color3.fromRGB(220, 220, 220)
InfoText.TextSize = 13
InfoText.Font = Enum.Font.SourceSans
InfoText.TextWrapped = true
InfoText.TextXAlignment = Enum.TextXAlignment.Left
InfoText.TextYAlignment = Enum.TextYAlignment.Top
InfoText.Parent = InfoFrame

local BackBtn = Instance.new("TextButton")
BackBtn.Size = UDim2.new(0.5, 0, 0, 30)
BackBtn.Position = UDim2.new(0.25, 0, 0.85, 0)
BackBtn.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
BackBtn.ZIndex = 6
BackBtn.Text = "Quay lại"
BackBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
BackBtn.Font = Enum.Font.SourceSansBold
BackBtn.TextSize = 13
BackBtn.Parent = InfoFrame
Instance.new("UICorner", BackBtn).CornerRadius = UDim.new(0, 5)

InfoBtn.MouseButton1Click:Connect(function() InfoFrame.Visible = not InfoFrame.Visible end)
BackBtn.MouseButton1Click:Connect(function() InfoFrame.Visible = false end)

-- Ô NHẬP THÔNG SỐ VŨ KHÍ & ĐỘ CAO
local function CreateSetting(text, defaultBox, posY)
    local lbl = Instance.new("TextLabel")
    lbl.Size = UDim2.new(0.35, 0, 0, 30)
    lbl.Position = UDim2.new(0.05, 0, posY, 0)
    lbl.BackgroundTransparency = 1
    lbl.Text = text
    lbl.TextColor3 = Color3.fromRGB(200, 200, 200)
    lbl.Font = Enum.Font.SourceSansBold
    lbl.TextSize = 14
    lbl.TextXAlignment = Enum.TextXAlignment.Left
    lbl.Parent = MainFrame

    local box = Instance.new("TextBox")
    box.Size = UDim2.new(0.55, 0, 0, 30)
    box.Position = UDim2.new(0.4, 0, posY, 0)
    box.BackgroundColor3 = Color3.fromRGB(45, 45, 55)
    box.Text = defaultBox
    box.TextColor3 = Color3.fromRGB(255, 255, 255)
    box.Font = Enum.Font.SourceSans
    box.TextSize = 14
    box.Parent = MainFrame
    return box
end

local Weapon1Box = CreateSetting("Vũ khí 1:", "Thousand SOULs Axe", 0.16)
local Weapon2Box = CreateSetting("Vũ khí 2:", "Reaper's Scythes", 0.28)
local HeightBox = CreateSetting("Độ cao:", "12", 0.40)

-- NÚT TỰ ĐỒNG NHẬP VŨ KHÍ
local AutoFillBtn = Instance.new("TextButton")
AutoFillBtn.Name = "AutoFillButton"
AutoFillBtn.Size = UDim2.new(0.28, 0, 0, 32)
AutoFillBtn.Position = UDim2.new(0.05, 0, 0.52, 0)
AutoFillBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50) -- Ban đầu là TẮT (Đỏ)
AutoFillBtn.Text = "Tự điền VK"
AutoFillBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
AutoFillBtn.Font = Enum.Font.SourceSansBold
AutoFillBtn.TextSize = 13
AutoFillBtn.Parent = MainFrame
Instance.new("UICorner", AutoFillBtn).CornerRadius = UDim.new(0, 6)

-- NHÃN TRẠNG THÁI (STATUS & TỰ ĐỘNG NHẬP VŨ KHÍ)
local StatusLbl = Instance.new("TextLabel")
StatusLbl.Size = UDim2.new(0.6, 0, 0, 18)
StatusLbl.Position = UDim2.new(0.36, 0, 0.50, 0)
StatusLbl.BackgroundTransparency = 1
StatusLbl.Text = "Trạng thái: Đã tắt"
StatusLbl.TextColor3 = Color3.fromRGB(255, 220, 50)
StatusLbl.Font = Enum.Font.SourceSansBold
StatusLbl.TextSize = 13
StatusLbl.TextXAlignment = Enum.TextXAlignment.Left
StatusLbl.Parent = MainFrame

local AutoDetectLbl = Instance.new("TextLabel")
AutoDetectLbl.Size = UDim2.new(0.6, 0, 0, 18)
AutoDetectLbl.Position = UDim2.new(0.36, 0, 0.58, 0)
AutoDetectLbl.BackgroundTransparency = 1
AutoDetectLbl.Text = "Tự động nhập tên vũ khí: Tắt"
AutoDetectLbl.TextColor3 = Color3.fromRGB(200, 200, 200)
AutoDetectLbl.Font = Enum.Font.SourceSans
AutoDetectLbl.TextSize = 12
AutoDetectLbl.TextXAlignment = Enum.TextXAlignment.Left
AutoDetectLbl.Parent = MainFrame

-- NÚT START AUTO FARM
local StartBtn = Instance.new("TextButton")
StartBtn.Size = UDim2.new(0.9, 0, 0, 40)
StartBtn.Position = UDim2.new(0.05, 0, 0.70, 0)
StartBtn.BackgroundColor3 = Color3.fromRGB(0, 150, 50)
StartBtn.Text = "BẮT ĐẦU AUTO FARM"
StartBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
StartBtn.Font = Enum.Font.SourceSansBold
StartBtn.TextSize = 15
StartBtn.Parent = MainFrame
Instance.new("UICorner", StartBtn).CornerRadius = UDim.new(0, 6)

-- LOGIC TỰ ĐỘNG LẤY TÊN VŨ KHÍ
local isAutoFillWeapons = false

local function AutoScanWeapons()
    local foundWeapons = {}
    local char = LocalPlayer.Character
    local backpack = LocalPlayer:FindFirstChild("Backpack")

    if char then
        for _, item in ipairs(char:GetChildren()) do
            if item:IsA("Tool") then
                table.insert(foundWeapons, item.Name)
            end
        end
    end

    if backpack then
        for _, item in ipairs(backpack:GetChildren()) do
            if item:IsA("Tool") then
                table.insert(foundWeapons, item.Name)
            end
        end
    end

    if #foundWeapons > 0 then
        Weapon1Box.Text = foundWeapons[1]
        if #foundWeapons > 1 then
            Weapon2Box.Text = foundWeapons[2]
        else
            Weapon2Box.Text = foundWeapons[1]
        end
    end
end

AutoFillBtn.MouseButton1Click:Connect(function()
    isAutoFillWeapons = not isAutoFillWeapons
    if isAutoFillWeapons then
        AutoFillBtn.BackgroundColor3 = Color3.fromRGB(0, 150, 50) -- BẬT (Xanh lá)
        AutoDetectLbl.Text = "Tự động nhập tên vũ khí: Mở"
        AutoScanWeapons()
    else
        AutoFillBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50) -- TẮT (Đỏ)
        AutoDetectLbl.Text = "Tự động nhập tên vũ khí: Tắt"
    end
end)

-- Vòng lặp liên tục quét vũ khí khi đang BẬT tự động nhập
task.spawn(function()
    while task.wait(1) do
        if isAutoFillWeapons then
            AutoScanWeapons()
        end
    end
end)

-- LOGIC AUTO FARM
local isAutoFarming = false
local currentTarget = nil

LocalPlayer.CharacterAdded:Connect(function(char)
    if isAutoFarming then
        task.wait(1)
        if char then
            for _, part in ipairs(char:GetDescendants()) do
                if part:IsA("BasePart") then
                    part.CanCollide = false
                end
            end
        end
    end
end)

local function GetClosestEnemy()
    local char = LocalPlayer.Character
    if not char or not char:FindFirstChild("HumanoidRootPart") then return nil end
    local root = char.HumanoidRootPart
    
    local targetFilter = Workspace:FindFirstChild("TargetFilter")
    local enemyFolder = targetFilter and targetFilter:FindFirstChild("Enemy")
    if not enemyFolder then return nil end

    local bestTarget = nil
    local bestDist = math.huge

    for _, enemy in ipairs(enemyFolder:GetChildren()) do
        if enemy:IsA("Model") then
            local values = enemy:FindFirstChild("Values")
            local hp = values and values:FindFirstChild("HP")
            
            if not hp or hp.Value > 0 then
                local eRoot = enemy.PrimaryPart or enemy:FindFirstChild("HumanoidRootPart") or enemy:FindFirstChildWhichIsA("BasePart")
                if eRoot then
                    local dist = (root.Position - eRoot.Position).Magnitude
                    if dist < bestDist then
                        bestTarget = enemy
                        bestDist = dist
                    end
                end
            end
        end
    end
    return bestTarget
end

local function PressKey(keyCode)
    VirtualInputManager:SendKeyEvent(true, keyCode, false, game)
    task.wait(0.05)
    VirtualInputManager:SendKeyEvent(false, keyCode, false, game)
end

local function EquipWeapon(weaponName)
    local char = LocalPlayer.Character
    if not char then return nil end
    
    local humanoid = char:FindFirstChildWhichIsA("Humanoid")
    if not humanoid or humanoid.Health <= 0 then return nil end

    local currentTool = char:FindFirstChildOfClass("Tool")
    if currentTool and currentTool.Name:lower() == weaponName:lower() then
        return currentTool
    end

    local backpack = LocalPlayer:FindFirstChild("Backpack")
    if backpack then
        for _, tool in ipairs(backpack:GetChildren()) do
            if tool:IsA("Tool") and tool.Name:lower() == weaponName:lower() then
                humanoid:EquipTool(tool)
                return tool
            end
        end
    end
    return nil
end

task.spawn(function()
    local toggleWeapon = false
    local skillKeys = {Enum.KeyCode.Z, Enum.KeyCode.X, Enum.KeyCode.C}

    while task.wait(0.1) do
        if isAutoFarming then
            local char = LocalPlayer.Character
            local humanoid = char and char:FindFirstChildWhichIsA("Humanoid")

            if humanoid and humanoid.Health > 0 then
                local w1 = Weapon1Box.Text:match("^%s*(.-)%s*$")
                local w2 = Weapon2Box.Text:match("^%s*(.-)%s*$")
                local activeWeaponName = (toggleWeapon and w2 ~= "") and w2 or w1

                if activeWeaponName and activeWeaponName ~= "" then
                    local tool = EquipWeapon(activeWeaponName)
                    if tool then
                        StatusLbl.Text = "Đang dùng: " .. activeWeaponName
                        
                        for _, key in ipairs(skillKeys) do
                            if not isAutoFarming then break end
                            PressKey(key)
                            task.wait(0.2)
                        end
                        
                        local startAttack = tick()
                        while (tick() - startAttack) < 5 do
                            if not isAutoFarming then break end
                            if not char:FindFirstChild(tool.Name) then
                                EquipWeapon(activeWeaponName)
                            end
                            tool:Activate()
                            task.wait(0.1)
                        end
                        toggleWeapon = not toggleWeapon
                    else
                        StatusLbl.Text = "Đang tìm vũ khí: " .. activeWeaponName
                        task.wait(0.5)
                    end
                else
                    StatusLbl.Text = "Tên vũ khí đang trống!"
                    task.wait(0.5)
                end
            else
                StatusLbl.Text = "Đang chờ hồi sinh..."
                task.wait(1)
            end
        end
    end
end)

RunService.Heartbeat:Connect(function()
    if not isAutoFarming then return end
    
    local char = LocalPlayer.Character
    if not char then return end
    
    local root = char:FindFirstChild("HumanoidRootPart")
    local humanoid = char:FindFirstChildWhichIsA("Humanoid")
    if not root or not humanoid or humanoid.Health <= 0 then return end
    
    humanoid.AutoRotate = false
    humanoid.PlatformStand = true

    if currentTarget then
        local hpVal = currentTarget:FindFirstChild("Values") and currentTarget.Values:FindFirstChild("HP")
        if not currentTarget.Parent or (hpVal and hpVal.Value <= 0) then
            currentTarget = nil
        end
    end

    if not currentTarget then
        currentTarget = GetClosestEnemy()
    end

    if currentTarget then
        local eRoot = currentTarget.PrimaryPart or currentTarget:FindFirstChild("HumanoidRootPart") or currentTarget:FindFirstChildWhichIsA("BasePart")
        if eRoot then
            local offsetHeight = tonumber(HeightBox.Text) or 12
            local targetPos = eRoot.Position + Vector3.new(0, offsetHeight, 0)
            
            root.CFrame = CFrame.lookAt(targetPos, eRoot.Position, Vector3.new(0, 1, 0))
            root.AssemblyLinearVelocity = Vector3.zero
            root.AssemblyAngularVelocity = Vector3.zero
        end
    end
end)

StartBtn.MouseButton1Click:Connect(function()
    isAutoFarming = not isAutoFarming
    local char = LocalPlayer.Character
    local humanoid = char and char:FindFirstChildWhichIsA("Humanoid")

    if isAutoFarming then
        StartBtn.Text = "DỪNG AUTO FARM"
        StartBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
        
        if char then
            for _, part in ipairs(char:GetDescendants()) do
                if part:IsA("BasePart") then part.CanCollide = false end
            end
        end
        currentTarget = GetClosestEnemy()
    else
        StartBtn.Text = "BẮT ĐẦU AUTO FARM"
        StartBtn.BackgroundColor3 = Color3.fromRGB(0, 150, 50)
        StatusLbl.Text = "Trạng thái: Đã tắt"
        
        if humanoid then
            humanoid.AutoRotate = true
            humanoid.PlatformStand = false
        end
        
        if char then
            for _, part in ipairs(char:GetDescendants()) do
                if part:IsA("BasePart") then part.CanCollide = true end
            end
        end
        currentTarget = nil
    end
end)

Features & Information

No fyp
#khoidethuong#trigaming

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts