Skip to content

Instantly share code, notes, and snippets.

@Sleitnick
Created April 14, 2023 18:01
Show Gist options
  • Save Sleitnick/1b7b7d049c9651f218c0f4d8b7c338cc to your computer and use it in GitHub Desktop.
Save Sleitnick/1b7b7d049c9651f218c0f4d8b7c338cc to your computer and use it in GitHub Desktop.
-- Run in LocalScript context.
-- Move mouse around to see Input event ordering in the output as well.
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local lastT = 0
local function FmtTime()
local t = time()
local line = t ~= lastT
lastT = t
if line then
print("------------------------")
end
return ("%.3f"):format(t)
end
-- Input
UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
print(FmtTime(), "Input")
end
end)
-- Hearbeat
RunService.Heartbeat:Connect(function()
print(FmtTime(), "Heartbeat")
end)
-- Stepped
RunService.Stepped:Connect(function()
print(FmtTime(), "Stepped")
end)
-- RenderStepped
RunService.RenderStepped:Connect(function()
print(FmtTime(), "RenderStepped")
end)
-- Wait
while true do
task.wait()
print(FmtTime(), "Wait")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment