Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://youtu.be/DOgBUAabBn0
- local RunService = game:GetService("RunService")
- local Players = game:GetService("Players")
- local player = Players.LocalPlayer
- local PlayerGui = player:WaitForChild("PlayerGui")
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "FPSGui"
- screenGui.Parent = PlayerGui
- local fpsLabel = Instance.new("TextLabel")
- fpsLabel.Size = UDim2.new(0,200,0,50)
- fpsLabel.Position = UDim2.new(0,10,0,10)
- fpsLabel.BackgroundTransparency = 0.5
- fpsLabel.BackgroundColor3 = Color3.new(0,0,0)
- fpsLabel.TextColor3 = Color3.new(1,1,1)
- fpsLabel.Font = Enum.Font.SourceSansBold
- fpsLabel.TextScaled = true
- fpsLabel.Text = "FPS: Calculating...."
- fpsLabel.Parent = screenGui
- local frameCount = 0
- local startTime = tick()
- RunService.Heartbeat:Connect(function()
- frameCount = frameCount + 1
- local elapsed = tick() - startTime
- if elapsed >= 1 then
- local fps = math.floor(frameCount/elapsed)
- fpsLabel.Text = "FPS: " .. fps
- frameCount = 0
- startTime = tick()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement