Fix Lag
Key RequiredUniversal

Fix Lag

Universal ScriptTheCoolFemboyTheCoolFemboy 788 views 65.1K executesUpdated Aug 3, 2026
Unrated
00
Lua Script•174 lines (6572 chars)
-- SCRIPT FIX LAG TOÀN NĂNG CHO MỌI GAME ROBLOX (UNIVERSAL NO-GFX CÓ GUI KÉO THẢ)
local CoreGui = game:GetService("CoreGui")
local Workspace = game:GetService("Workspace")
local Lighting = game:GetService("Lighting")
local UserInputService = game:GetService("UserInputService")
local Camera = Workspace.CurrentCamera

-- 1. Tạo Giao Diện Không Bị Reset Khi Chết
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "Universal_AntiLag_GUI"
ScreenGui.ResetOnSpawn = false

pcall(function() ScreenGui.Parent = CoreGui end)
if not ScreenGui.Parent then
    ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
end

-- Tạo nút bấm Toggle
local ToggleButton = Instance.new("TextButton")
ToggleButton.Name = "ToggleButton"
ToggleButton.Size = UDim2.new(0, 140, 0, 40)
ToggleButton.Position = UDim2.new(0, 10, 0.4, 0)
ToggleButton.BackgroundColor3 = Color3.fromRGB(255, 60, 60) -- Màu đỏ (Đang Tắt)
ToggleButton.Text = "Universal Lag: OFF"
ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleButton.Font = Enum.Font.SourceSansBold
ToggleButton.TextSize = 14
ToggleButton.BorderSizePixel = 0
ToggleButton.ClipsDescendants = true
ToggleButton.Parent = ScreenGui

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

-- 2. Hệ Thống Kéo Thả Di Chuyển (PC & Mobile)
local dragging, dragInput, dragStart, startPos
local function update(input)
    local delta = input.Position - dragStart
    ToggleButton.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end

ToggleButton.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        dragging = true
        dragStart = input.Position
        startPos = ToggleButton.Position
        input.Changed:Connect(function()
            if input.UserInputState == Enum.UserInputState.End then dragging = false end
        end)
    end
end)

ToggleButton.InputChanged:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
        dragInput = input
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if input == dragInput and dragging then update(input) end
end)

-- 3. Cơ Chế Giảm Tải Đồ Họa Toàn Năng
local FixLagEnabled = false
local OriginalParts = {}
local OriginalShadows = Lighting.GlobalShadows

-- Định nghĩa các Class hiệu ứng cần xử lý
local EffectClasses = {
    "ParticleEmitter", "Trail", "Beam", "Fire", "Smoke", "Sparkles", "Explosion", 
    "Decal", "Texture", "PostEffect", "Atmosphere", "Sky", "Clouds", "SunRaysEffect"
}

local function applyFixLag(v)
    if not FixLagEnabled then return end
    
    -- Xử lý các loại hạt và hiệu ứng môi trường thông qua ClassName gốc của Roblox
    for _, className in ipairs(EffectClasses) do
        if v:IsA(className) then
            if v:IsA("ParticleEmitter") or v:IsA("Trail") or v:IsA("Beam") or v:IsA("Fire") or v:IsA("Smoke") or v:IsA("Sparkles") then
                v.Enabled = false
            elseif v:IsA("Explosion") or v:IsA("PostEffect") or v:IsA("Atmosphere") or v:IsA("SunRaysEffect") then
                if v:IsA("Explosion") then v.Visible = false else v.Enabled = false end
            elseif v:IsA("Decal") or v:IsA("Texture") then
                v.Transparency = 1
            end
            return
        end
    end
    
    -- Xử lý vật thể thô (Khối xây dựng map, skill đòn đánh dạng Mesh)
    if v:IsA("BasePart") and not v:IsDescendantOf(game.Players.LocalPlayer.Character) then
        if not OriginalParts[v] then
            OriginalParts[v] = {Material = v.Material, CastShadow = v.CastShadow, Transparency = v.Transparency}
        end
        v.Material = Enum.Material.SmoothPlastic
        v.CastShadow = false
        
        -- Nhận diện các khối kỹ năng lớn thường trong suốt hoặc có tên chứa từ khóa đặc biệt để ẩn đi
        local nameLower = v.Name:lower()
        if nameLower:find("effect") or nameLower:find("mesh") or nameLower:find("hit") or v.Transparency > 0.5 then
            v.Transparency = 1
        end
    end
end

-- Hàm khôi phục lại đồ họa ban đầu
local function restoreGraphics()
    Lighting.GlobalShadows = OriginalShadows
    
    -- Bật lại hiệu ứng ánh sáng môi trường
    for _, v in pairs(Lighting:GetChildren()) do
        for _, className in ipairs(EffectClasses) do
            if v:IsA(className) and (v:IsA("PostEffect") or v:IsA("Atmosphere") or v:IsA("SunRaysEffect")) then
                v.Enabled = true
            end
        end
    end
    
    -- Trả lại chất liệu và độ trong suốt cho các khối
    for part, orig in pairs(OriginalParts) do
        if part and part.Parent then
            part.Material = orig.Material
            part.CastShadow = orig.CastShadow
            part.Transparency = orig.Transparency
        end
    end
    
    -- Bật lại hạt và decal trên toàn map
    for _, v in pairs(Workspace:GetDescendants()) do
        if v:IsA("ParticleEmitter") or v:IsA("Trail") or v:IsA("Beam") or v:IsA("Fire") or v:IsA("Smoke") or v:IsA("Sparkles") then
            v.Enabled = true
        elseif v:IsA("Decal") or v:IsA("Texture") then
            v.Transparency = 0
        end
    end
    table.clear(OriginalParts)
end

-- Vòng lặp bắt các hiệu ứng phát sinh thời gian thực (Kỹ năng tung ra)
local function onDescendantAdded(v)
    if FixLagEnabled then
        task.spawn(function()
            task.wait()
            if v and v.Parent then applyFixLag(v) end
        end)
    end
end

Workspace.DescendantAdded:Connect(onDescendantAdded)
Camera.DescendantAdded:Connect(onDescendantAdded)

-- 4. Logic Nút Bấm
ToggleButton.MouseButton1Click:Connect(function()
    FixLagEnabled = not FixLagEnabled
    
    if FixLagEnabled then
        ToggleButton.Text = "Universal Lag: ON"
        ToggleButton.BackgroundColor3 = Color3.fromRGB(60, 220, 60) -- Xanh lá
        Lighting.GlobalShadows = false
        
        -- Quét toàn cục trò chơi
        for _, v in pairs(Workspace:GetDescendants()) do applyFixLag(v) end
        for _, v in pairs(Lighting:GetChildren()) do applyFixLag(v) end
        for _, v in pairs(Camera:GetDescendants()) do applyFixLag(v) end
    else
        ToggleButton.Text = "Universal Lag: OFF"
        ToggleButton.BackgroundColor3 = Color3.fromRGB(255, 60, 60) -- Đỏ
        restoreGraphics()
    end
end)

print("--- ĐÃ KHỞI CHẠY SCRIPT FIX LAG TOÀN NĂNG ROBLOX CHÀO MỪNG BẠN ---")

Features & Information

Fix lag on every games Script for me not for you =)) Don't blamming about the thumbnail i don't have time =(

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts