MaxproGlitcher

montre les FPS et le ping simple code

Jul 19th, 2024 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. --[[
  2. By MaxproGlitcher
  3. ]]
  4. local screenGui = Instance.new("ScreenGui")
  5. screenGui.Name = "FPSPingGui"
  6. screenGui.Parent = game:GetService("CoreGui")
  7. local fpsLabel = Instance.new("TextLabel")
  8. fpsLabel.Name = "FPSLabel"
  9. fpsLabel.Size = UDim2.new(0, 200, 0, 60) -- Increased size to 200x60
  10. fpsLabel.Position = UDim2.new(0, -10, 0, 10)
  11. fpsLabel.BackgroundTransparency = 1
  12. fpsLabel.TextColor3 = Color3.new(1, 1, 1)
  13. fpsLabel.TextStrokeTransparency = 0
  14. fpsLabel.Font = Enum.Font.SourceSans
  15. fpsLabel.TextSize = 40 -- Increased text size to 40
  16. fpsLabel.Parent = screenGui
  17. local pingLabel = Instance.new("TextLabel")
  18. pingLabel.Name = "PingLabel"
  19. pingLabel.Size = UDim2.new(0, 100, 0, 50)
  20. pingLabel.Position = UDim2.new(0, 165, 0, 15) -- Adjusted position to be next to the FPS counter
  21. pingLabel.BackgroundTransparency = 1
  22. pingLabel.TextColor3 = Color3.new(1, 1, 1)
  23. pingLabel.TextStrokeTransparency = 0
  24. pingLabel.Font = Enum.Font.SourceSans
  25. pingLabel.TextSize = 24
  26. pingLabel.Parent = screenGui
  27. local function calculateFPS()
  28. local lastTime = tick()
  29. local frames = 0
  30. game:GetService("RunService").RenderStepped:Connect(function()
  31. frames = frames + 1
  32. local currentTime = tick()
  33. if currentTime - lastTime >= 0.1 then
  34. local fps = math.floor(frames / (currentTime - lastTime))
  35. fpsLabel.Text = "FPS: " .. tostring(fps)
  36. if fps < 10 then
  37. fpsLabel.TextColor3 = Color3.new(1, 0, 0) -- Red color
  38. else
  39. fpsLabel.TextColor3 = Color3.new(1, 1, 1) -- White color
  40. end
  41. frames = 0
  42. lastTime = currentTime
  43. end
  44. end)
  45. end
  46. local function calculatePing()
  47. game:GetService("RunService").Heartbeat:Connect(function()
  48. local ping = game:GetService("Stats").Network.ServerStatsItem["Data Ping"]:GetValue()
  49. pingLabel.Text = "Ping: " .. tostring(math.floor(ping)) .. " ms"
  50. if ping > 300 then
  51. pingLabel.TextColor3 = Color3.new(1, 0, 0) -- Red color
  52. else
  53. pingLabel.TextColor3 = Color3.new(1, 1, 1) -- White color
  54. end
  55. end)
  56. end
  57. calculateFPS()
  58. calculatePing()
Advertisement
Add Comment
Please, Sign In to add comment