Hello Everyone. How can I wrap text box manually with a script without using the TextWrapped property?
I’d really appreciate it if someone can tell me how, thank you.
Newline is represented by \n
in a string.
textbox.Text = "new\nline"
I know that, but since it’s a text box, it updates everytime a player times something. I want it so that it acts like it’s textwarped but it’s not textwarped (if you don’t get it, it’s when the player is typing something, and then it reaches the end of the textbox, it automatically puts the next input in the next line)
like this for example,
enable rich text in the textbox that should fix it with text wrapped on
Text wrapped is bugged so I can’t really use it. I need to do the text wrapping manually with a script
no text wrapped is not bug it works just fine for me
Yes, but if a textbox Y-AutomaticSize is enabled with TextWarped enabled too and it’s parented to a scrolling frame with AutomaticCanvasSize enabled, it won’t work properly and can only expand until the same size as the scrolling frame’s AbsoluteSize. It’s a studio bug and the only way I can fix it (I think) is making my own text warp function
ok what you can THEN do is add a text label that covers the text button copy its property to the text label display the text on the text label make the text buttons text transparency to 1 and text labels back transparency to 1 as well then see if the textfits property is false then add a \n
in the text by doing text.Text ..= "\n"
Hi, I too got the same problem, I was trying to make a script to multiline the player name if it is too long, I will be glad to share the script.
Script(Sever Script):
local MaximumLength = 20 --max letters for the textbox
local TextBox = TextBox --mention the textbox's text
local TextLength = string.len(TextBox.Text) --this will define the number of letters
local NewText = string.sub(TextBox.Text, MaximumLength, TextLength) --the letters above the max len
if TextLength > MaximumLength then
local Clone = Instance.new("TextLabel", TextBox)
Clone.Text = NewText
Clone.Size = TextBox.Size
Clone.BackgroundTransparency = 1
Clone.TextSize = TextBox.TextSize
Clone.TextColor = TextBox.TextColor
Clone.Font = TextBox.Font
local NewPos = TextBox.Position
local YScaleNewPos = 0.7 --set to padding you want for the textbox and Clone(I recommend keep it 0.7)
Clone.Position = UDim2.new(NewPos.X.Scale, NewPos.Y.Scale + YScaleNewPos, NewPos.Z.Scale)
end
I don’t understand what you mean, can you explain it again?
Is this only for one time setting? since mine is constantly changing so I don’t think this will work? still thanks.
Try doing :GetPropertyChangedSignal(“Text”)
local MaximumLength = 20 --max letters for the textbox
local TextBox = TextBox --mention the textbox's text
local TextLength = TextBox.TextContent:len() --this will define the number of letters
local NewText = TextBox.TextContent:sub(MaximumLength, TextLength) --the letters above the max len
TextBox:GetPropertyChangedSignal("TextContent"):Connect(function()
if TextLength > MaximumLength then
local Clone = Instance.new("TextLabel", TextBox)
Clone.Text = NewText
Clone.Size = TextBox.Size
Clone.BackgroundTransparency = 1
Clone.TextSize = TextBox.TextSize
Clone.TextColor = TextBox.TextColor
Clone.Font = TextBox.Font
local NewPos = TextBox.Position
local YScaleNewPos = 0.7 --set to padding you want for the textbox and Clone(I recommend keep it 0.7)
Clone.Position = UDim2.new(NewPos.X.Scale, NewPos.Y.Scale + YScaleNewPos, NewPos.Z.Scale)
end
end)
Some slight adjustments have been made, including adding the changed signal
it doesn’t work, still thanks!
Is there an error???
Chaaaaaarrrs
no, but it doesn’t put it in a new line, it just continues
Alright we’ll in like half an hour I’ll be able to get on my laptop and try and make this for you!
okay, thank you!
this is a thread I opened before,
maybe it can help you understand what I mean
there’s also a sample script there, but it’s bugged and not really smooth. I’d be really glad if you can help me fix it.
Also, my bad it’s supposed to be ContentText not TextContent, try that
still doesn’t work
hjkhjkhj