Advertisement
KrYn0MoRe

server stats board script

Aug 1st, 2020 (edited)
922
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.55 KB | None | 0 0
  1. Part0 = Instance.new("Part")
  2. SurfaceGui1 = Instance.new("SurfaceGui")
  3. TextLabel2 = Instance.new("TextBox")
  4. TextLabel3 = Instance.new("TextBox")
  5. TextLabel4 = Instance.new("TextBox")
  6. Part0.Parent = script
  7. Part0.CFrame = CFrame.new(0, 8.08998775, -19.2699966, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  8. Part0.Position = Vector3.new(0, 8.08998775, -19.2699966)
  9. Part0.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  10. Part0.Size = Vector3.new(20, 10, 2)
  11. Part0.Anchored = true
  12. Part0.BottomSurface = Enum.SurfaceType.Smooth
  13. Part0.BrickColor = BrickColor.new("Really black")
  14. Part0.CanCollide = false
  15. Part0.Locked = true
  16. Part0.Material = Enum.Material.SmoothPlastic
  17. Part0.TopSurface = Enum.SurfaceType.Smooth
  18. Part0.brickColor = BrickColor.new("Really black")
  19. SurfaceGui1.Parent = Part0
  20. SurfaceGui1.LightInfluence = 1
  21. SurfaceGui1.Face = Enum.NormalId.Back
  22. SurfaceGui1.ClipsDescendants = true
  23. SurfaceGui1.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  24. SurfaceGui1.Adornee = Part0
  25. TextLabel2.Name = "fps"
  26. TextLabel2.Parent = SurfaceGui1
  27. TextLabel2.Size = UDim2.new(1, 0, 0.330000013, 0)
  28. TextLabel2.BackgroundColor = BrickColor.new("Institutional white")
  29. TextLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
  30. TextLabel2.BackgroundTransparency = 1
  31. TextLabel2.Font = Enum.Font.SourceSans
  32. TextLabel2.FontSize = Enum.FontSize.Size96
  33. TextLabel2.Text = "N/A"
  34. TextLabel2.TextColor = BrickColor.new("Institutional white")
  35. TextLabel2.TextColor3 = Color3.new(1, 1, 1)
  36. TextLabel2.TextScaled = true
  37. TextLabel2.TextSize = 100
  38. TextLabel2.TextWrap = true
  39. TextLabel2.TextWrapped = true
  40. TextLabel3.Name = "memory"
  41. TextLabel3.Parent = SurfaceGui1
  42. TextLabel3.Position = UDim2.new(0, 0, 0.330000013, 0)
  43. TextLabel3.Size = UDim2.new(1, 0, 0.330000013, 0)
  44. TextLabel3.BackgroundColor = BrickColor.new("Institutional white")
  45. TextLabel3.BackgroundColor3 = Color3.new(1, 1, 1)
  46. TextLabel3.BackgroundTransparency = 1
  47. TextLabel3.Font = Enum.Font.SourceSans
  48. TextLabel3.FontSize = Enum.FontSize.Size96
  49. TextLabel3.Text = "N/A"
  50. TextLabel3.TextColor = BrickColor.new("Institutional white")
  51. TextLabel3.TextColor3 = Color3.new(1, 1, 1)
  52. TextLabel3.TextScaled = true
  53. TextLabel3.TextSize = 100
  54. TextLabel3.TextWrap = true
  55. TextLabel3.TextWrapped = true
  56. TextLabel4.Name = "physicstep"
  57. TextLabel4.Parent = SurfaceGui1
  58. TextLabel4.Position = UDim2.new(0, 0, 0.660000026, 0)
  59. TextLabel4.Size = UDim2.new(1, 0, 0.330000013, 0)
  60. TextLabel4.BackgroundColor = BrickColor.new("Institutional white")
  61. TextLabel4.BackgroundColor3 = Color3.new(1, 1, 1)
  62. TextLabel4.BackgroundTransparency = 1
  63. TextLabel4.Font = Enum.Font.SourceSans
  64. TextLabel4.FontSize = Enum.FontSize.Size96
  65. TextLabel4.Text = "N/A"
  66. TextLabel4.TextColor = BrickColor.new("Institutional white")
  67. TextLabel4.TextColor3 = Color3.new(1, 1, 1)
  68. TextLabel4.TextScaled = true
  69. TextLabel4.TextSize = 100
  70. TextLabel4.TextWrap = true
  71. TextLabel4.TextWrapped = true
  72.  
  73. local p = Part0
  74.  
  75. local stats = game:GetService("Stats")
  76.  
  77. local fps = 60
  78. local memory = 0
  79. local physicstep = 0
  80.  
  81. local _fps,_memory,_physicstep
  82.  
  83. local cf = p.CFrame
  84.  
  85. function update_p()
  86.     --p.CFrame = cf
  87.     game:GetService("TweenService"):Create(p,TweenInfo.new(0),{CFrame = cf}):Play()
  88.     p.Size = Vector3.new(15,10,2)
  89.     p.Parent = script
  90.     p.CanCollide = false
  91.     p.Anchored = true
  92.     p.Locked = true
  93.     p.Archivable = false
  94. end
  95.  
  96. update_p()
  97.  
  98. for i,v in pairs(p:GetDescendants()) do
  99.     if v:IsA("SurfaceGui") then
  100.         v.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
  101.         v.PixelsPerStud = 100
  102.     elseif v.Name == 'fps' then
  103.         _fps = v
  104.     elseif v.Name == 'memory' then
  105.         _memory = v
  106.     elseif v.Name == 'physicstep' then
  107.         _physicstep = v
  108.     end
  109. end
  110.  
  111. function change_color(cur,max,obj,mode)
  112.     local r,g,b = 1,1,1
  113.     if (cur > max) then
  114.         cur = max
  115.     end
  116.     if mode == 1 then
  117.         cur = cur/max
  118.     elseif mode == 2 then
  119.         cur = (max-cur)/max
  120.     end
  121.     r = cur
  122.     g = g-r
  123.     b = b-r
  124.     obj.TextColor3 = Color3.new(r,g,b)
  125.     --game:GetService("TweenService"):Create(obj,TweenInfo.new(1),{TextColor = Color3.new(r,g,b)}):Play()
  126. end
  127.  
  128. game:GetService("RunService").Heartbeat:Connect(function(t)
  129.     local f = 1/t
  130.     fps = math.round(f*10)/10
  131.     memory = stats:GetTotalMemoryUsageMb()
  132.     memory = math.round(memory*10)/10
  133.     physicstep = stats.PhysicsStepTimeMs
  134.     physicstep = math.round(physicstep*1000)/1000
  135.     _fps.Text = 'SERVER FPS: ' .. tostring(fps)
  136.     _memory.Text = 'MEMORY(MB): ' .. tostring(memory) .. '/6250'
  137.     _physicstep.Text = 'PHYSICS STEP TIME(MS): ' .. tostring(physicstep)
  138.     change_color(fps,30,_fps,2) -- 1/30
  139.     change_color(memory,7000,_memory,1) -- 7GB memory max
  140.     change_color(physicstep,1000,_physicstep,1) -- 1000ms = 1s
  141.     update_p()
  142. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement