Learn
Motor Sınıfı
TextBox

*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.


Kod Örnekleri
Metin Kutusu Gizli Kelime
-- Bu kodu bir Metin Kutusunun içine bir LocalScript'e yerleştirin
local textBox = script.Parent
local secretWord = "roblox"
local colorNormal = Color3.new(1, 1, 1) -- beyaz
local colorWrong = Color3.new(1, 0, 0) -- kırmızı
local colorCorrect = Color3.new(0, 1, 0) -- yeşil
-- textBox'ın durumunu başlat
textBox.ClearTextOnFocus = true
textBox.Text = ""
textBox.Font = Enum.Font.Code
textBox.PlaceholderText = "Gizli kelime nedir?"
textBox.BackgroundColor3 = colorNormal
local function onFocused()
textBox.BackgroundColor3 = colorNormal
end
local function onFocusLost(enterPressed, _inputObject)
if enterPressed then
local guess = textBox.Text
if guess == secretWord then
textBox.Text = "GİRİŞ İZNİ VERİLDİ"
textBox.BackgroundColor3 = colorCorrect
else
textBox.Text = "GİRİŞ YASAKLANDI"
textBox.BackgroundColor3 = colorWrong
end
else
-- Oyuncu Enter'a basmadan düzenlemeyi durdurdu
textBox.Text = ""
textBox.BackgroundColor3 = colorNormal
end
end
textBox.FocusLost:Connect(onFocusLost)
textBox.Focused:Connect(onFocused)

API Referansı
Özellikler
ClearTextOnFocus
Paralel oku
Capabilities: UI
TextBox.ClearTextOnFocus:boolean

ContentText
Salt Okunur
Çoğaltılmamış
Paralel oku
Capabilities: UI
TextBox.ContentText:string

CursorPosition
Paralel oku
Capabilities: UI
TextBox.CursorPosition:number
Kod Örnekleri
Metin Kutusu Seçimleri
local textBox = script.Parent
local function showSelection()
if textBox.CursorPosition == -1 or textBox.SelectionStart == -1 then
print("Seçim yok")
else
local selectedText = string.sub(
textBox.Text,
math.min(textBox.CursorPosition, textBox.SelectionStart),
math.max(textBox.CursorPosition, textBox.SelectionStart)
)
print('Seçim şudur:"', selectedText, '"')
end
end
textBox:GetPropertyChangedSignal("CursorPosition"):Connect(showSelection)
textBox:GetPropertyChangedSignal("SelectionStart"):Connect(showSelection)

Font
Gizli
Çoğaltılmamış
Paralel oku
Capabilities: UI
TextBox.Font:Enum.Font

FontFace
Paralel oku
Capabilities: UI
TextBox.FontFace:Font

FontSize
Artık Kullanılmayan

LineHeight
Paralel oku
Capabilities: UI
TextBox.LineHeight:number

MaxVisibleGraphemes
Paralel oku
Capabilities: UI
TextBox.MaxVisibleGraphemes:number

MultiLine
Paralel oku
Capabilities: UI
TextBox.MultiLine:boolean

OpenTypeFeatures
Paralel oku
Capabilities: UI
TextBox.OpenTypeFeatures:string

OpenTypeFeaturesError
Salt Okunur
Çoğaltılmamış
Paralel oku
Capabilities: UI
TextBox.OpenTypeFeaturesError:string

PlaceholderColor3
Paralel oku
Capabilities: UI
TextBox.PlaceholderColor3:Color3

PlaceholderText
Paralel oku
Capabilities: UI
TextBox.PlaceholderText:string

RichText
Paralel oku
Capabilities: UI
TextBox.RichText:boolean

SelectionStart
Paralel oku
Capabilities: UI
TextBox.SelectionStart:number
Kod Örnekleri
Metin Kutusu Seçimleri
local textBox = script.Parent
local function showSelection()
if textBox.CursorPosition == -1 or textBox.SelectionStart == -1 then
print("Seçim yok")
else
local selectedText = string.sub(
textBox.Text,
math.min(textBox.CursorPosition, textBox.SelectionStart),
math.max(textBox.CursorPosition, textBox.SelectionStart)
)
print('Seçim şudur:"', selectedText, '"')
end
end
textBox:GetPropertyChangedSignal("CursorPosition"):Connect(showSelection)
textBox:GetPropertyChangedSignal("SelectionStart"):Connect(showSelection)

ShowNativeInput
Paralel oku
Capabilities: UI
TextBox.ShowNativeInput:boolean

Text
Paralel oku
Capabilities: UI
TextBox.Text:string

TextBounds
Salt Okunur
Çoğaltılmamış
Paralel oku
Capabilities: UI
TextBox.TextBounds:Vector2

TextColor
Artık Kullanılmayan

TextColor3
Paralel oku
Capabilities: UI
TextBox.TextColor3:Color3
Kod Örnekleri
Sesli Harf Tespit Edici
local textBox = script.Parent
local function hasVowels(str)
return str:lower():find("[aeiou]")
end
local function onTextChanged()
local text = textBox.Text
-- Sesli harfleri kontrol et
if hasVowels(text) then
textBox.TextColor3 = Color3.new(0, 0, 0) -- Siyah
else
textBox.TextColor3 = Color3.new(1, 0, 0) -- Kırmızı
end
end
textBox:GetPropertyChangedSignal("Text"):Connect(onTextChanged)

TextDirection
Paralel oku
Capabilities: UI
TextBox.TextDirection:Enum.TextDirection

TextEditable
Paralel oku
Capabilities: UI
TextBox.TextEditable:boolean

TextFits
Salt Okunur
Çoğaltılmamış
Paralel oku
Capabilities: UI
TextBox.TextFits:boolean

TextScaled
Paralel oku
Capabilities: UI
TextBox.TextScaled:boolean

TextSize
Paralel oku
Capabilities: UI
TextBox.TextSize:number

TextStrokeColor3
Paralel oku
Capabilities: UI
TextBox.TextStrokeColor3:Color3

TextStrokeTransparency
Paralel oku
Capabilities: UI
TextBox.TextStrokeTransparency:number

TextTransparency
Paralel oku
Capabilities: UI
TextBox.TextTransparency:number

TextTruncate
Paralel oku
Capabilities: UI
TextBox.TextTruncate:Enum.TextTruncate

TextWrap
Artık Kullanılmayan

TextWrapped
Paralel oku
Capabilities: UI
TextBox.TextWrapped:boolean

TextXAlignment
Paralel oku
Capabilities: UI
TextBox.TextXAlignment:Enum.TextXAlignment

TextYAlignment
Paralel oku
Capabilities: UI
TextBox.TextYAlignment:Enum.TextYAlignment

Yöntemler
CaptureFocus
Capabilities: UI
TextBox:CaptureFocus():()
Dönüşler
()
Kod Örnekleri
Metin Kutusu Odaklama
local UserInputService = game:GetService("UserInputService")
local textBox = script.Parent
local input = UserInputService.InputBegan:Connect(function(input, processed)
if input.KeyCode == Enum.KeyCode.Q then
textBox:CaptureFocus()
end
end)

IsFocused
Capabilities: UI
TextBox:IsFocused():boolean
Dönüşler

ReleaseFocus
Capabilities: UI
TextBox:ReleaseFocus(submitted:boolean):()
Parametreler
submitted:boolean
Varsayılan değer: false
Dönüşler
()
Kod Örnekleri
Metin Kutusunun Odak Kontrolünü Bırak
local UserInputService = game:GetService("UserInputService")
local textBox = script.Parent
local input = UserInputService.InputBegan:Connect(function(input, processed)
if input.KeyCode == Enum.KeyCode.Escape and textBox.IsFocused then
textBox:ReleaseFocus()
end
end)

Olaylar
Focused
Capabilities: UI
TextBox.Focused():RBXScriptSignal
Kod Örnekleri
Metin Kutusu Odak
local textBox = script.Parent
textBox.Focused:Connect(function()
print("Odaklandı!")
end)
textBox.FocusLost:Connect(function()
print("Odak kaybedildi!")
end)

FocusLost
Capabilities: UI
TextBox.FocusLost(
enterPressed:boolean, inputThatCausedFocusLoss:InputObject
Parametreler
enterPressed:boolean
inputThatCausedFocusLoss:InputObject
Kod Örnekleri
Metin Kutusu Odak
local textBox = script.Parent
textBox.Focused:Connect(function()
print("Odaklandı!")
end)
textBox.FocusLost:Connect(function()
print("Odak kaybedildi!")
end)
OdakKaybı
local textBox = script.Parent
local function onFocusLost(enterPressed, inputThatCausedFocusLost)
if enterPressed then
print("Oyuncu Enter'a bastı")
else
print("Oyuncu bastı", inputThatCausedFocusLost.KeyCode)
end
end
textBox.FocusLost:Connect(onFocusLost)
MetinKutusu.FokusKaybı1
local gui = script.Parent
local textBox = gui.TextBox
local function focusLost(enterPressed)
if enterPressed then
print("Enter'a basıldığı için odak kaybedildi!")
else
print("Enter'a basılmadan odak kaybedildi")
end
end
textBox.FocusLost:Connect(focusLost)

ReturnPressedFromOnScreenKeyboard
Capabilities: UI
TextBox.ReturnPressedFromOnScreenKeyboard():RBXScriptSignal

©2026 Roblox Corporation. Roblox, the Roblox logo and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.