Using GTM UI
Call notifications, help text, menus, and instruction cards from any resource — one clean export API.
All features are client-side exports on the gtm-ui resource. Use the same calls from Lua or JavaScript.
Notifications
local id = exports['gtm-ui']:showNotification({
title = "Payment received",
message = "You earned $500.",
type = "success", -- "info" | "success" | "warning" | "error"
duration = 5000, -- milliseconds; omit to use the config default
})Dismiss early when you need to:
exports['gtm-ui']:hideNotification(id)Help text
exports['gtm-ui']:showHelpText({
message = "Press ~INPUT_CONTEXT~ to open the menu",
duration = 4000, -- optional; omit for persistent text
})
exports['gtm-ui']:hideHelpText()Menus
exports['gtm-ui']:openMenu({
id = "myresource:shop",
title = "Item Shop",
subtitle = "Choose an item",
items = {
{ id = "burger", label = "Burger", badge = "$5" },
{ id = "water", label = "Water", badge = "$2" },
{ id = "sep", label = "", type = "separator" },
{
id = "color",
label = "Body colour",
type = "list",
listValues = {
{ label = "Midnight Black", value = 0 },
{ label = "Arctic White", value = 1 },
},
listIndex = 0,
},
{ id = "alarm", label = "Car alarm", type = "checkbox", checked = true },
},
})Player selections arrive as local events for the menu id you provided. Close the menu when you are done:
exports['gtm-ui']:closeMenu()Instruction cards
exports['gtm-ui']:showInstructionCard({
title = "Welcome",
message = "Follow the marker to begin.",
})
exports['gtm-ui']:hideInstructionCard()Key badges in text
In messages, you can highlight keys with {key:E} or {hotkey:interact} so players see a clear control badge instead of plain text.
Tips
- Keep menu
idvalues unique per resource - Prefer short titles and one clear action per notification
- Match your theme in
config.jsonso every script shares the same visual language