I’m using a script to make the textbox scrollable if the text exceeds the limits, i got the code from another topic. It was working fine but suddenly it started freezing roblox studio whenever i added an extra line.
local textArea = script.Parent
local scrollFrame = script.Parent.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)
Script timeout: exhausted allowed execution time, on the while loop