Username
Method
Username displays a player's username on a text element.
Overview
The Username Method takes a UserId, fetches the player's username, and applies it to the instance's Text property. You can optionally format the text around the name.
Setup
- Add the
UiUtilstag on your text element - Add Attribute
Method=Username - Add Attribute
UserIdwith one of the accepted values
Attributes
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
UserId |
Number / String | Yes | — | The player to display. Accepts a raw UserId, LocalPlayer, or Random |
FormatedText |
String | No | — | A format string where %s is replaced by the username. For example, Welcome, %s! becomes Welcome, PlayerName! |
Examples
Show the local player's name:
- Tag:
UiUtils Method=UsernameUserId=LocalPlayer
Show a welcome message:
- Tag:
UiUtils Method=UsernameUserId=LocalPlayerFormatedText=Welcome, %s!
Show a specific player's name:
- Tag:
UiUtils Method=UsernameUserId=12345678
Notes
- The instance must have a
Textproperty (TextLabel,TextButton,TextBox) - If
UserIdis missing:You have not set the UserId attribute.