How to make scrollable textbox? So if it’s already reach limit, the textbox can be scrollable.
This is my attempt, but idk why it’s failed
-- Local Script
local textArea = script.Parent.TextBox
local scrollFrame = script.Parent
textArea:GetPropertyChangedSignal("TextFits"):Connect(function()
while textArea.TextFits == false do
scrollFrame.CanvasSize = UDim2.new(0, 0, 0, scrollFrame.CanvasSize.Y.Offset + 16)
scrollFrame.CanvasPosition = Vector2.new(0, scrollFrame.CanvasSize.Y.Offset - scrollFrame.AbsoluteWindowSize.Y)
end
end)
textArea:GetPropertyChangedSignal("TextBounds"):Connect(function()
if scrollFrame.CanvasSize.Y.Offset > textArea.TextBounds.Y + 16 then
scrollFrame.CanvasSize = UDim2.new(0, 0, 0, textArea.TextBounds.Y)
scrollFrame.CanvasPosition = Vector2.new(0, scrollFrame.CanvasSize.Y.Offset - scrollFrame.AbsoluteWindowSize.Y)
end
end)
You would have to put the textbox in a scrolling frame.
1 Like
I have updated my question because I already put inside scrolling frame but it doesn’t work.
Textbox Property : TextScaled false, TextWrapped false, MultiLine true.
Make the canvas size 2,0,1,0
But I want it’s only scrollable only when the textbox reach it’s limit, I think that’s why I use TextBounds
Ok, sorry I misunderstood your question, try checking the TextFits
property on your textbox, if it’s false then change the CanvaSize to +1 on the y
You can see the script that I use on the post? I wrote that too.
Set ScrollingFrame.AutomaticCanvasSize to Y and CanvasSize to 0, 0, 0, 0
I get the script from this forum and it use TextFits too but i dont know when it reach limit i still cant scroll, the scroll canvassize is bigger, i check it, but i still cant scroll it.
I don’t know if all of you can see pictures and script that I wrote on the post, because I literally do what all of you recommend but still doesn’t allow me to scroll.
Look, I’ve helped with this type of question before on this topic, if the solution from the guy that solved this topic doesn;t work let me know and I will help you myself: How to wrap texts with a script - #24 by HeyWhatsHisFace
NeoBuilds
(NeoBuilds)
May 4, 2022, 8:17pm
#14
You also need to set TextBox.AutomaticSize to Y
Thanks, didn’t realize as simple as this -_-
So it’s gonna be the same to textlabel right?
NeoBuilds
(NeoBuilds)
May 4, 2022, 8:22pm
#17
If it also uses AutomaticSize then yes
Yup and thanks a lot for your solution too, if I can check two solutions, would love too.