NiceBBMBThai

Anti Lag 2

Dec 31st, 2024
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.38 KB | None | 0 0
  1. -- Roblox Universal AntiLag Script by Marko97
  2. if not gethui then
  3.     warn("Incompatible executor: gethui is unavailable")
  4.     return
  5. end
  6.  
  7. local runService = game:GetService("RunService")
  8. local lighting = game:GetService("Lighting")
  9.  
  10. local fpsCounterGui = Instance.new("ScreenGui", gethui())
  11. local fpsLabel = Instance.new("TextLabel", fpsCounterGui)
  12.  
  13. fpsCounterGui.Name = "FpsCounterGui"
  14. fpsCounterGui.IgnoreGuiInset = true
  15. fpsLabel.Name = "FpsLabel"
  16. fpsLabel.BackgroundTransparency = 1
  17. fpsLabel.Position = UDim2.new(1, -100, 0, 0)
  18. fpsLabel.Size = UDim2.new(0, 100, 0, 30)
  19. fpsLabel.Text = ""
  20. fpsLabel.TextSize = 16
  21. fpsLabel.TextStrokeTransparency = 0.6
  22. fpsLabel.Draggable = true
  23.  
  24. local function GetFPS(delay)
  25.     local startTime = tick()
  26.     local frames = 0
  27.     local heartbeatConnection = runService.Heartbeat:Connect(function()
  28.         frames = frames + 1
  29.     end)
  30.     task.wait(delay)
  31.     heartbeatConnection:Disconnect()
  32.     local elapsedTime = tick() - startTime
  33.     local fps = frames / elapsedTime
  34.     return math.ceil(fps)
  35. end
  36.  
  37. task.spawn(function()
  38.     while true do
  39.         local fps = GetFPS(0.5)
  40.         if fps >= 60 then
  41.             fpsLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
  42.         elseif fps <= 59 and fps > 50 then
  43.             fpsLabel.TextColor3 = Color3.fromRGB(255, 170, 0)
  44.         elseif fps <= 49 and fps > 30 then
  45.             fpsLabel.TextColor3 = Color3.fromRGB(255, 85, 0)
  46.         elseif fps <= 29 then
  47.             fpsLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
  48.         end
  49.         fpsLabel.Text = tostring(fps) .. " FPS"
  50.     end
  51. end)
  52.  
  53. lighting.GlobalShadows = false
  54. lighting.FogEnd = 9e9
  55. lighting.EnvironmentDiffuseScale = 0.5
  56. lighting.EnvironmentSpecularScale = 0.5
  57.  
  58. for _, descendant in ipairs(game:GetDescendants()) do
  59.     if descendant:IsA("BasePart") then
  60.         descendant.CastShadow = false
  61.         descendant.Material = Enum.Material.SmoothPlastic
  62.         descendant.Reflectance = 0
  63.         if descendant:IsA("MeshPart") then
  64.             descendant.CollisionFidelity = Enum.CollisionFidelity.Box
  65.         end
  66.     end
  67.     if descendant:IsA("Decal") or descendant:IsA("Texture") then
  68.         if descendant.Transparency > 0.25 then
  69.             descendant.Transparency = 0.25
  70.         end
  71.     end
  72.     if descendant:IsA("ParticleEmitter") or descendant:IsA("Trail") then
  73.         descendant.Lifetime = NumberRange.new(0)
  74.     end
  75. end
Add Comment
Please, Sign In to add comment