Resizing UI based on how many lines there are

When I use this script

local changelog = require(game.ReplicatedStorage.Changelog)

local cur = ""
local start = 0

for i,v in pairs(changelog) do
		if #v.Numbered == 3 then
			v.Numbered = v.Numbered..".0"
		local temp = script.Parent.Temp:Clone()
		temp.Visible = true
		temp.Ver.Text = v.Ver.." "..v.Numbered
		temp.Desc.Text = v.Desc
		if cur ~= v.Ver then
			local temp2 = script.Parent.NewTemp:Clone()
			temp2.Visible = true
			temp2.Ver.Text = v.Ver
			temp2.LayoutOrder = (start*10)-1
			temp2.Parent = script.Parent.Scrolling
			script.Parent.Scrolling.CanvasSize +=,0,0,temp2.Size.Y.Offset)
		start = i
		cur = v.Ver
		temp.LayoutOrder = #changelog*10
		temp.Parent = script.Parent.Scrolling
		temp.Desc.Size =,0,0,temp.Desc.TextBounds.Y+4)
		temp.Size =,0,0,temp.Desc.Size.Y.Offset+temp.Ver.Size.Y.Offset)
		script.Parent.Scrolling.CanvasSize +=,0,0,temp.Size.Y.Offset)

script.Parent.Scrolling.CanvasSize +=,0,0,5)

It works in Studio but not TeamTest or Roblox. Is there any reason why and what fixes are there, i’ve tried using task.wait() in multiple parts of the script and still nothing worked.

Why not use ScrollFrames instead?


Use a scrolling frame with the property “AutomaticCanvasSize” property set to Y

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.