Advertisement
ILovePotato

Lag detector☣️

Dec 17th, 2024
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. -- Notification + Console Script with Crash Detection
  2. -- Works for most Roblox executors
  3.  
  4. local StarterGui = game:GetService("StarterGui")
  5. local RunService = game:GetService("RunService")
  6.  
  7. -- Function to send a notification to the player
  8. local function SendNotification(title, text, duration)
  9. StarterGui:SetCore("SendNotification", {
  10. Title = title,
  11. Text = text,
  12. Duration = duration or 5
  13. })
  14. end
  15.  
  16. -- On-Screen Notification: Look at the console
  17. SendNotification("Notification", "Look at the console. Type /console in chat to open the console.", 10)
  18.  
  19. -- Print Message to Console
  20. print("There no problem :)")
  21.  
  22. -- Lag and Crash Detection
  23. local lastFrameTime = tick() -- Time of last frame render
  24. local crashThreshold = 2 -- Threshold for extreme lag/crash detection in seconds
  25.  
  26. RunService.RenderStepped:Connect(function()
  27. local currentFrameTime = tick()
  28. local delta = currentFrameTime - lastFrameTime -- Time between frames
  29. lastFrameTime = currentFrameTime
  30.  
  31. -- Lag Warning (over 0.5 seconds of delay)
  32. if delta > 0.5 and delta < crashThreshold then
  33. warn("You are lagging⚠️")
  34. end
  35.  
  36. -- Crash Warning (extreme delay)
  37. if delta >= crashThreshold then
  38. error("You are about to crash☢️")
  39. end
  40. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement