Classe do mecanismo
TextButton
*Este conteúdo é traduzido por IA (Beta) e pode conter erros. Para ver a página em inglês, clique aqui.
Resumo
Propriedades
Referência API
Propriedades
Font
Amostras de código
Mostrar Todas as Fontes
local frame = script.Parent
-- Crie um TextLabel exibindo cada fonte
for _, font in pairs(Enum.Font:GetEnumItems()) do
local textLabel = Instance.new("TextLabel")
textLabel.Name = font.Name
-- Defina as propriedades do texto
textLabel.Text = font.Name
textLabel.Font = font
-- Algumas propriedades de renderização
textLabel.TextSize = 24
textLabel.TextXAlignment = Enum.TextXAlignment.Left
-- Tamanho do frame igual à altura do texto
textLabel.Size = UDim2.new(1, 0, 0, textLabel.TextSize)
-- Adicione ao frame pai
textLabel.Parent = frame
end
-- Organize os frames em uma lista (se já não estiverem)
if not frame:FindFirstChildOfClass("UIListLayout") then
local uiListLayout = Instance.new("UIListLayout")
uiListLayout.Parent = frame
endFontSize
Text
Amostras de código
Banner Desvanecente
local TweenService = game:GetService("TweenService")
local textLabel = script.Parent
local content = {
"Bem-vindo ao meu jogo!",
"Certifique-se de se divertir!",
"Por favor, dê sugestões!",
"Seja gentil com outros jogadores!",
"Não estrague a diversão de outros jogadores!",
"Confira a loja!",
"Dica: Não morra!",
}
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local RNG = Random.new()
local fadeIn = TweenService:Create(textLabel, tweenInfo, {
TextTransparency = 0,
})
local fadeOut = TweenService:Create(textLabel, tweenInfo, {
TextTransparency = 1,
})
local lastIndex
while true do
-- Passo 0: Desvanecer antes de fazer qualquer coisa
fadeOut:Play()
task.wait(tweenInfo.Time)
-- Passo 1: escolher conteúdo que não foi o último exibido
local index
repeat
index = RNG:NextInteger(1, #content)
until lastIndex ~= index
-- Certifique-se de que não mostremos a mesma coisa da próxima vez
lastIndex = index
-- Passo 2: mostrar o conteúdo
textLabel.Text = content[index]
fadeIn:Play()
task.wait(tweenInfo.Time + 1)
endEmoji em Texto
local textLabel = script.Parent
local moods = {
["happy"] = "😃",
["sad"] = "😢",
["neutral"] = "😐",
["tired"] = "😫",
}
while true do
for mood, face in pairs(moods) do
textLabel.Text = "Estou me sentindo " .. mood .. "! " .. face
task.wait(1)
end
endTextColor
TextColor3
Amostras de código
Texto de Contagem Regressiva
-- Coloque este código em um LocalScript dentro de um TextLabel/TextButton
local textLabel = script.Parent
-- Algumas cores que usaremos com TextColor3
local colorNormal = Color3.new(0, 0, 0) -- preto
local colorSoon = Color3.new(1, 0.5, 0.5) -- vermelho
local colorDone = Color3.new(0.5, 1, 0.5) -- verde
-- Loop infinita
while true do
-- Contar regressivamente de 10 a 1
for i = 10, 1, -1 do
-- Definir o texto
textLabel.Text = "Tempo: " .. i
-- Definir a cor com base em quanto tempo resta
if i > 3 then
textLabel.TextColor3 = colorNormal
else
textLabel.TextColor3 = colorSoon
end
task.wait(1)
end
textLabel.Text = "VAI!"
textLabel.TextColor3 = colorDone
task.wait(2)
endTextWrap