Skip to content

tw.input

Side: Client

Native RedM onscreen keyboard input. Blocking call that yields the current thread.

Functions

tw.input.native(label, placeholder, maxStringLength?)

Opens the native onscreen keyboard and waits for the player to submit or cancel.

ParameterTypeDefaultDescription
labelstringTitle displayed above the keyboard
placeholderstringPlaceholder text in the input field
maxStringLengthinteger?60Maximum number of characters

Returns: string — The text entered by the player, or "" (empty string) if the player pressed Escape.

Examples

Basic text input

lua
local name = tw.input.native("Rename", "Enter a new name")

if name ~= "" then
    print("Player entered: " .. name)
else
    print("Player cancelled input")
end

Limited input length

lua
local code = tw.input.native("Door Code", "Enter 4-digit code", 4)

if code ~= "" then
    TriggerServerEvent("doorlock:tryCode", code)
end

Notes

  • This function is blocking (yields the thread). It will not return until the player submits or cancels.
  • Returns an empty string "" when the player presses Escape.
  • The native keyboard is the standard RedM/GTA input overlay.

Premium RedM Scripts — Multi-Framework