I am trying to make a PID, for a project I’m working on. As you can see in the gif, it only takes a max amount of text then truncates it. If I don’t truncate it, it will cut mid scrolling and go back to the beginning. https://gyazo.com/c596546df1516ba9206eaefe2df057dc
I cut the GIF short as it only allows six seconds, but I have more text after that.
EDIT : I’ve realized that it’s got to do with the size of the TextBox but if I increase it too much it takes a very long time to display. Is there anyway to count the number of characters and resize the textbox based on that?
This is my script:
local images = {script.Parent.TextLabel}
while wait() do
for _,v in pairs(images) do
local temp = v.Position.X.Scale
if (temp <= -v.Size.X.Scale) then
temp = 5
end
v.Position = UDim2.new(temp - 0.025 , 0, 0.4, 0)
end
end
Something like this to set the size of a TextBox based on the area the text takes, TextScaled needs to be off:
local size = game.TextService:GetTextSize(obj.Text, obj.TextSize, obj.Font, obj.AbsoluteSize)
obj.Size = UDim2.new(obj.Size.X.Scale, obj.Size.X.Offset, 0, size.Y)
-- resizes only on its Y
Hook this to a GetPropertyChangedSignal(“Text”) to resize after text is inputted.
Edit: Added functional sample
local obj = something.TextBox
local function resize()
local size = game.TextService:GetTextSize(obj.Text, obj.TextSize, obj.Font, obj.AbsoluteSize)
obj.Size = UDim2.new(obj.Size.X.Scale, obj.Size.X.Offset, 0, size.Y)
end
box:GetPropertyChangedSignal(“Text”):Connect(resize)
# the quotation marks get formatted here, fix them in the script