RB
RB Studios

Exports

Complete client export reference for RB HUD with Lua, TypeScript, and C# examples.

RB HUD exposes 20 client exports. Call them only from client scripts after rb_hud has started. There are currently no server exports.

The resource must be named rb_hud. Every example below uses that exact resource name.

Complete language examples

Each tab calls every available export. In normal code, call only the methods needed for your integration.

local hud = exports.rb_hud

hud:initHud()
hud:hidePlayerHud()
hud:showPlayerHud()
hud:hideHud()
hud:setOxygen(75)
hud:hideHudExceptVoice()
hud:showHud()
hud:editMode()
hud:changeMapMode('Only in Vehicle')
hud:changeCompassMode('Always On')
hud:changeCompassStyle('Bar')
hud:refreshMapDisplay()
hud:showMapDisplay(true)
hud:hideMapDisplay()
hud:setMapHudHidden(true)

local mapHidden = hud:isMapHudHidden()
local anchor = hud:getMinimapAnchor()

hud:showCompassDisplay()
hud:hideCompassDisplay()
hud:toggleCinematic(true)
type HudDisplayMode = "Only in Vehicle" | "Always On" | "Always Off";
type CompassStyle = "Default" | "Bar";

interface MinimapAnchor {
  x: number;
  y: number;
  LeftX: number;
  TopY: number;
  RightX: number;
  BottomY: number;
  CenterX: number;
  CenterY: number;
  Width: number;
  Height: number;
}

interface RbHudExports {
  initHud(): void;
  hidePlayerHud(): void;
  showPlayerHud(): void;
  hideHud(): void;
  setOxygen(value: number): void;
  hideHudExceptVoice(): void;
  showHud(): void;
  editMode(): void;
  changeMapMode(mode: HudDisplayMode): void;
  changeCompassMode(mode: HudDisplayMode): void;
  changeCompassStyle(style: CompassStyle): void;
  refreshMapDisplay(): void;
  showMapDisplay(load?: boolean): void;
  hideMapDisplay(): void;
  setMapHudHidden(hidden: boolean): void;
  isMapHudHidden(): boolean;
  getMinimapAnchor(): MinimapAnchor | null;
  showCompassDisplay(): void;
  hideCompassDisplay(): void;
  toggleCinematic(enabled: boolean): void;
}

const hud = exports["rb_hud"] as RbHudExports;

hud.initHud();
hud.hidePlayerHud();
hud.showPlayerHud();
hud.hideHud();
hud.setOxygen(75);
hud.hideHudExceptVoice();
hud.showHud();
hud.editMode();
hud.changeMapMode("Only in Vehicle");
hud.changeCompassMode("Always On");
hud.changeCompassStyle("Bar");
hud.refreshMapDisplay();
hud.showMapDisplay(true);
hud.hideMapDisplay();
hud.setMapHudHidden(true);

const mapHidden = hud.isMapHudHidden();
const anchor = hud.getMinimapAnchor();

hud.showCompassDisplay();
hud.hideCompassDisplay();
hud.toggleCinematic(true);

These calls belong inside a class derived from BaseScript, where the FiveM Exports property is available.

dynamic hud = Exports["rb_hud"];

hud.initHud();
hud.hidePlayerHud();
hud.showPlayerHud();
hud.hideHud();
hud.setOxygen(75);
hud.hideHudExceptVoice();
hud.showHud();
hud.editMode();
hud.changeMapMode("Only in Vehicle");
hud.changeCompassMode("Always On");
hud.changeCompassStyle("Bar");
hud.refreshMapDisplay();
hud.showMapDisplay(true);
hud.hideMapDisplay();
hud.setMapHudHidden(true);

bool mapHidden = (bool)hud.isMapHudHidden();
dynamic anchor = hud.getMinimapAnchor();

hud.showCompassDisplay();
hud.hideCompassDisplay();
hud.toggleCinematic(true);

Full HUD and lifecycle

ExportParametersReturnsBehavior
initHudNoneNothingInitializes player HUD state and starts its update loop. RB HUD normally calls this automatically after the framework reports a loaded player.
hideHudNoneNothingHides player, vehicle, compass, and minimap elements and keeps the minimap suppressed across normal refreshes.
hideHudExceptVoiceNoneNothingHides the HUD while retaining the voice/microphone indicator, useful for death or knockout flows.
showHudNoneNothingRe-enables the HUD. Map and compass visibility still follows the player's selected display modes.
toggleCinematicenabled: booleanNothingShows or hides the cinematic bars and inversely hides or restores HUD elements.

Cinematic mode

exports.rb_hud:toggleCinematic(true)

-- Later
exports.rb_hud:toggleCinematic(false)
exports["rb_hud"].toggleCinematic(true);

// Later
exports["rb_hud"].toggleCinematic(false);
Exports["rb_hud"].toggleCinematic(true);

// Later
Exports["rb_hud"].toggleCinematic(false);

Player HUD

ExportParametersReturnsBehavior
hidePlayerHudNoneNothingHides only the player status HUD.
showPlayerHudNoneNothingShows only the player status HUD.
setOxygenvalue: numberNothingUpdates the diving-oxygen indicator. The displayed value is clamped to 0–100.

setOxygen is intended for diving gear or other resources that maintain an oxygen value independently of GTA's normal underwater timer.

exports.rb_hud:setOxygen(65)
exports["rb_hud"].setOxygen(65);
Exports["rb_hud"].setOxygen(65);

Editor and saved preferences

ExportParametersReturnsBehavior
editModeNoneNothingOpens HUD Studio and enables cursor focus. Complete named profiles persist in the player's versioned rb_hud_profiles KVP.
changeMapModemode: stringNothingPersists and applies Only in Vehicle, Always On, or Always Off.
changeCompassModemode: stringNothingPersists and applies Only in Vehicle, Always On, or Always Off.
changeCompassStylestyle: stringNothingPersists and applies Default or Bar.

Pass the strings exactly as shown, including capitalization and spaces.

exports.rb_hud:changeMapMode('Always On')
exports.rb_hud:changeCompassMode('Only in Vehicle')
exports.rb_hud:changeCompassStyle('Bar')
exports["rb_hud"].changeMapMode("Always On");
exports["rb_hud"].changeCompassMode("Only in Vehicle");
exports["rb_hud"].changeCompassStyle("Bar");
Exports["rb_hud"].changeMapMode("Always On");
Exports["rb_hud"].changeCompassMode("Only in Vehicle");
Exports["rb_hud"].changeCompassStyle("Bar");

Minimap

ExportParametersReturnsBehavior
refreshMapDisplayNoneNothingRe-evaluates minimap visibility from the manual-hidden state, saved mode, and current vehicle.
showMapDisplayload?: booleanNothingRefreshes the minimap. With true, waits for the session, recalculates saved offsets, and initializes it first. It still respects the saved map mode.
hideMapDisplayNoneNothingImmediately hides the minimap. A later automatic refresh can show it again.
setMapHudHiddenhidden: booleanNothingChanges the manual-hidden flag. Call refreshMapDisplay or hideMapDisplay afterward to redraw immediately.
isMapHudHiddenNoneBooleanReturns the manual-hidden flag. This is not necessarily the current radar visibility.
getMinimapAnchorNoneTable/object or nullReturns normalized screen bounds after minimap initialization, otherwise nil/null.

Use setMapHudHidden(true) plus hideMapDisplay() when another UI needs the map to stay hidden. Restore it with setMapHudHidden(false) followed by refreshMapDisplay().

Minimap anchor shape

FieldMeaning
x, LeftXLeft edge in normalized screen coordinates.
y, TopYTop edge in normalized screen coordinates.
RightX, BottomYRight and bottom edges.
CenterX, CenterYCenter point.
Width, HeightNormalized minimap dimensions.

Compass

ExportParametersReturnsBehavior
showCompassDisplayNoneNothingStarts/continues compass updates and shows it only when the saved compass mode allows it.
hideCompassDisplayNoneNothingHides the compass and stops its update loop.

The Bar style also displays nearby map blips and updates more frequently than the default directional compass.

On this page