Type Index Pages
- BillboardGui
- Frame
- Hint
- ImageButton
- ImageLabel
- PlayerGui
- ScreenGui
- ScrollingFrame
- StarterGui
- SurfaceGui
- TextBox
- TextButton
- TextLabel
- UIAspectRatioConstraint
- UIGradient
- UIGridLayout
- UIListLayout
- UIPadding
- UIPageLayout
- UIScale
- UISizeConstraint
- UITableLayout
- UITextSizeConstraint
- VideoFrame
- ViewportFrame
- ChangeHistoryService
- CoreGui
- DataModelSession
- DockWidgetPluginGui
- MultipleDocumentInterfaceInstance
- Plugin
- PluginAction
- PluginGui
- PluginGuiService
- PluginManager
- PluginMenu
- PluginMouse
- PluginToolbar
- PluginToolbarButton
- QWidgetPluginGui
- Selection
- StandalonePluginScripts
- StatsItem
- StudioService
- StudioTheme
No results found!
-
Instance
- GameSettings
- DebugSettings
- BodyMover
- WeldConstraint
- HttpRbxApiService
- NotificationService
- Translator
- Lighting
- Beam
- GuiService
- UserInputService
- Studio
- Plugin
- HttpService
- Mouse
- BindableEvent
- RunService
- Pages
- Humanoid
- TestService
- PathfindingService
- Chat
- NetworkPeer
- Feature
- CharacterAppearance
- Constraint
- NetworkReplicator
- JointInstance
- Light
- BasePlayerGui
- AnalyticsService
- NetworkMarker
- BinaryStringValue
- FlyweightService
- Geometry
- LoginService
- InstancePacketCache
- ThirdPartyUserService
- TouchInputService
- RuntimeScriptService
- GuidRegistryService
- PartOperationAsset
- DialogChoice
- PhysicsService
- AdService
- TextService
- MarketplaceService
- TeleportService
- Accoutrement
- GamePassService
- AssetService
- InsertService
- PointsService
- ChangeHistoryService
- ServerScriptService
- JointsService
- LogService
- InputObject
- Toolbar
- LuaSettings
- RenderSettings
- AnimationTrack
- PhysicsSettings
- NetworkSettings
- CFrameValue
- Animation
- Color3Value
- BoolValue
- BrickColorValue
- Vector3Value
- AnimationController
- BindableFunction
- Button
- Trail
- LocalizationTable
- LocalizationService
- DebuggerBreakpoint
- DebuggerWatch
- ScriptDebugger
- Animator
- Attachment
- RemoteFunction
- RemoteEvent
- PluginManager
- Camera
- Stats
- Sky
- StarterPlayer
- Dragger
- TerrainRegion
- Path
- TextFilterResult
- Dialog
- StatsItem
- GoogleAnalyticsConfiguration
- ScriptContext
- ControllerService
- CacheableContentProvider
- ReflectionMetadataClasses
- ReflectionMetadataEnums
- DebuggerManager
- GuiBase
- UIBase
- LuaSourceContainer
- GuiItem
- DataModelMesh
- ServiceProvider
- ReflectionMetadataItem
- PostEffect
- PhysicsPacketCache
- TouchTransmitter
- RobloxReplicatedStorage
- Visit
- LuaWebService
- ScriptService
- FlagStandService
- VirtualUser
- SpawnerService
- TimerService
- CookiesService
- Team
- GroupService
- StarterGear
- Message
- PlayerScripts
- Configuration
- ContentProvider
- CollectionService
- Debris
- ReplicatedFirst
- ServerStorage
- ReplicatedStorage
- Folder
- TweenService
- Players
- ContextActionService
- StarterPlayerScripts
- SoundService
- KeyframeSequenceProvider
- VRService
- PluginGuiService
- Player
- Teams
- Pose
- Keyframe
- KeyframeSequence
- IntConstrainedValue
- DoubleConstrainedValue
- ForceField
- RayValue
- Fire
- Smoke
- Sparkles
- ParticleEmitter
- IntValue
- StringValue
- NumberValue
- Explosion
- ObjectValue
- SoundGroup
- UserGameSettings
- ClickDetector
- Sound
- Selection
- BadgeService
- TaskScheduler
- GlobalDataStore
- DataStoreService
- CustomEvent
- CustomEventReceiver
- VirtualInputManager
- FunctionalTest
- TweenBase
- SoundEffect
- ReflectionMetadataEvents
- ClusterPacketCache
- PVInstance
- FaceInstance
- Controller
- ReflectionMetadataCallbacks
- ReflectionMetadataFunctions
- ReflectionMetadataYieldFunctions
- ReflectionMetadataProperties
- ReflectionMetadata
- AdvancedDragger
- HapticService
- FriendService
- GamepadService
No Result Found !!!
Text
The Text property determines the content rendered by the UI element. The visual properties of the string rendered to the screen is determined by TextBox/TextColor3
, TextBox/TextTransparency
, TextBox/TextSize
, TextBox/Font
, TextBox/TextScaled
, TextBox/TextWrapped
, TextBox/TextXAlignment
and TextBox/TextYAlignment
.
It is possible to render emoji (for example, 😃) and other symbols. These special symbols aren’t affected by the TextBox/TextColor3
property. These can be pasted into Script
and LocalScript
objects, as well as the field within the Properties window.
This property may contain newline characters, however, it is not possible to type newline characters within the Properties window. Similarly, this property may contain a tab character, but it will render as a space instead.
Code Samples
Show All Fonts
This code sample renders a list of all the available fonts.
local frame = script.Parent -- Create a TextLabel displaying each font for i, font in pairs(Enum.Font:GetEnumItems()) do local tl = Instance.new("TextLabel") tl.Name = font.Name -- Set the text properties tl.Text = font.Name tl.Font = font -- Some rendering properties tl.TextSize = 24 tl.TextXAlignment = Enum.TextXAlignment.Left -- Size the frame equal to the height of the text tl.Size = UDim2.new(1, 0, 0, tl.TextSize) -- Add to the parent frame tl.Parent = frame end -- Layout the frames in a list (if they aren't already) if not frame:FindFirstChildOfClass("UIListLayout") then Instance.new("UIListLayout", frame) end
Fading Banner
This code sample creates a fading banner for a TextLabel. It fades text out, chooses a random string (avoiding repetition), and fades back in.
local textLabel = script.Parent local content = { "Welcome to my game!"; "Be sure to have fun!"; "Please give suggestions!"; "Be nice to other players!"; "Don't grief other players!"; "Check out the shop!"; "Tip: Don't die!"; } local function fadeOut() for i = textLabel.TextTransparency, 1, .1 do wait(.1) textLabel.TextTransparency = i end end local function fadeIn() for i = textLabel.TextTransparency, 0, -.1 do wait(.1) textLabel.TextTransparency = i end end local lastIndex while true do -- Step 0: Fade out before doing anything fadeOut() -- Step 1: pick content that wasn't the last displayed local index repeat index = math.random(1, #content) until lastIndex ~= index -- Make sure we don't show the same thing next time lastIndex = index -- Step 2: show the content textLabel.Text = content[index] fadeIn() wait(2) end
"Kaboom!" Text
This code sample repeatedly tweens a TextLabel’s TextSize from 5 to 100 and fades out the text as it grows in size.
local textLabel = script.Parent textLabel.Text = "Kaboom!" while true do for size = 5, 100, 5 do textLabel.TextSize = size textLabel.TextTransparency = size / 100 wait() end wait(1) end
Long Text Wrapping
This code sample demonstrates TextWrap by spelling out a long chunk of text progressively. If the text doesn’t fit, it turns a different color.
local textLabel = script.Parent -- This text wrapping demo is best shown on a 200x50 px rectangle textLabel.Size = UDim2.new(0, 200, 0, 50) -- Some content to spell out local content = "Here's a long string of words that will " .. "eventually exceed the UI element's width " .. "and form line breaks. Useful for paragraphs " .. "that are really long." -- A function that will spell text out two characters at a time local function spellTheText() -- Iterate from 1 to the length of our content for i = 1, content:len() do -- Get a substring of our content: 1 to i textLabel.Text = content:sub(1, i) -- Color the text if it doesn't fit in our box if textLabel.TextFits then textLabel.TextColor3 = Color3.new(0, 0, 0) -- Black else textLabel.TextColor3 = Color3.new(1, 0, 0) -- Red end -- Wait a brief moment on even lengths if i % 2 == 0 then wait() end end end while true do -- Spell the text with scale/wrap off textLabel.TextWrapped = false textLabel.TextScaled = false spellTheText() wait(1) -- Spell the text with wrap on textLabel.TextWrapped = true textLabel.TextScaled = false spellTheText() wait(1) -- Spell the text with text scaling on -- Note: Text turns red (TextFits = false) once text has to be -- scaled down in order to fit within the UI element. textLabel.TextScaled = true -- Note: TextWrapped is enabled implicitly when TextScaled = true --textLabel.TextWrapped = true spellTheText() wait(1) end
Emoji in Text
This code sample demonstrates emoji rendering using the Text property.
local textLabel = script.Parent local moods = { ["happy"] = "😃"; ["sad"] = "😢"; ["neutral"] = "😐"; ["tired"] = "😫"; } while true do for mood, face in pairs(moods) do textLabel.Text = "I am feeling " .. mood .. "! " .. face wait(1) end end
How this site use cookies
This Platform uses cookies to offer you a better experience, to personalize content, to provide social media features and to analyse the traffic on our site. For further information, including information on how to prevent or manage the use of cookies on this Platform, please refer to our Privacy and Cookie Policy.