@rbxts/device

Platform/Device helper functions for Roblox

Usage no npm install needed!

<script type="module">
  import rbxtsDevice from 'https://cdn.skypack.dev/@rbxts/device';
</script>

README

Device

A utility to get device information.

Useful for knowing what controls to assign to a user, or a custom experience/UI per platform/device.

GetPlatformType()

Returns the platform type

  • console - Is XBox
  • desktop - Is Windows or MacOS
  • tablet - Is iOS or Android tablet
  • phone Is iOS or Android phone

GetAspectRatio

Gets the aspect ratio of the screen

Returns an array of two numbers, e.g. a 1920x1080 screen will give you [16, 9]