Roblox error tracking installation
- 1
Install the Roblox SDK
RequiredPostHog is available for Roblox through Wally or as a model file you import in Studio.
Via Wally, add the dependency to your
wally.toml, runwally install, and map the package intoReplicatedStorage:tomlYou can also download the latest
posthog-roblox.rbxmfrom the releases page and insert it intoReplicatedStoragein Studio. Either way you should end up withReplicatedStorage > PostHog.Make sure HTTP requests are enabled for your experience: Game Settings > Security > Allow HTTP Requests.
- 2
Configure PostHog
RequiredInitialize PostHog once from a server
Script(for example inServerScriptService), keeping error capture enabled:luaYou can find your project token and instance address in the project settings page in PostHog.
- 3
Capture exceptions
RequiredThe Roblox SDK captures exceptions automatically by default. On the server it listens to
ScriptContext.Error; requiring the module from aLocalScriptcaptures unhandled client errors and relays them to the server.Captured events include the error message, the stack trace when available, and SDK metadata.
For handled errors, call
CaptureExceptionmanually with a subject, message, and optional trace and properties:luaIdentified usersServer events are already attributed to the player you pass as the subject (by their
UserId), so exceptions are linked to known users in PostHog automatically. - 4
Configure error tracking options
OptionalOption Type Default Description captureErrorsboolean trueEnables automatic exception capture. errorDebounceSecondsnumber 1Minimum seconds between automatic server error captures. To disable automatic exception capture:
lua Verify error tracking
RecommendedTrigger a test exception and confirm it appears in the Error tracking tab.
luaTo test automatic capture, raise an unhandled error from a server
Script:lua