Customui:setText(playerid, uiid, elementid, text)
API description The main purpose of this method is to set the content of the text symbol
Parameters | Types | Info |
---|---|---|
playerid | number | player ID |
uiid | string | the ID of interface |
elementid | string | the ID of component |
text | string | value of text to be parsed |
animid | number | animation ID (optinal) |
time | number | animation duration (optional & minimum is 0.1) |
mode | number | playback mode (default) |
Return | value | type |
---|---|---|
Error Code 0 is Success | 0 or 1001 | number |
--This function is executed when the player clicks on the block local function clickblock(event) local playerid = event.eventobjid --Click on the player's mini number of the block local uiid = "6986982063319417057"--Interface ID local elementid ="6986982063319417057_1"--Text element id local text="Hello"-- The text content to be set --Set the display of the player's text ui element Customui:setText(playerid, uiid, elementid, text) end -- Register Event for Player.ClickBlock ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], clickblock)
This Lua code creates an event handler that responds when a player clicks on a block in the game.
local function clickblock(event)
* Declares a function named clickblock that triggers on the event * The event parameter contains information about the interaction
local playerid=event.eventobjid
* Extracts the player's unique identifier from the event object * Identifies which player clicked the block
local uiid="6986982063319417057" // Interface ID local elementid="6986982063319417057_1" // Text element ID local text="Hello" // Text content to display
* uiid: Unique identifier for the UI component * elementid: Specific text element within the UI * text: The message that will appear (“Hello”)
Customui:setText(playerid, uiid, elementid, text)
* Calls the game's CustomUI system to show text to the player * Parameters:
ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], clickblock)
* Registers the clickblock function as a handler for Player.ClickBlock events * Syntax breakdown:
This demonstrates:
Result: When any player clicks a block, they see “Hello” in a UI element.
ID | Name |
---|---|
40001 | Typewriter |
0 | Default |
Example :
-- Let's assume UIID and Element id is already defined -- This Will set text with _Typewriter_ animation in 1 seconds (default playback once) Customui:setText(1029380338, uiid , elementid, text , 40001 , 1)