Advertisement
ERROR_CODE

Скорость связи с сайтом

Nov 9th, 2024 (edited)
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. local screenGui = Instance.new("ScreenGui")
  2. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  3.  
  4. local textLabel = Instance.new("TextLabel")
  5. textLabel.Size = UDim2.new(0, 200, 0, 80)
  6. textLabel.Position = UDim2.new(0.5, -100, 0.5, -25)
  7. textLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  8. textLabel.TextColor3 = Color3.new(1, 1, 1)
  9. textLabel.TextScaled = true
  10. textLabel.Parent = screenGui
  11.  
  12. local function getInternetSpeed()
  13.     local httpService = game:GetService("HttpService")
  14.     local startTime = tick()
  15.     local data = httpService:UrlEncode("https://www.scriptblox.com")
  16.     local endTime = tick()
  17.     local dataSize = #data
  18.     local timeTaken = endTime - startTime
  19.     local speed = (dataSize / 1024) / timeTaken
  20.     return speed
  21. end
  22.  
  23. local function formatNumber(num)
  24.     if num >= 1000 then
  25.         return string.format("%.2f", num / 1000) .. " KB/s"
  26.     else
  27.         return string.format("%.2f", num) .. " B/s"
  28.     end
  29. end
  30.  
  31. while wait(1) do
  32.     local speed = getInternetSpeed()
  33.     textLabel.Text = formatNumber(speed)
  34. end
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement