Need help for use UIGridLayout / AutoSizeAdjust

So, I try to make a Logs GUI which puts a line by text while enlarging the scroll bar The problem is that, I don’t really know how to do it, I’m already try Absolute ContentSize but without success i found ContentSize but i don’t found how to use it

So this is the problem without Absolute CententSize

So the scrollbar don’t update but the line are good
The script

local BindableEvent = game.ReplicatedStorage:WaitForChild("MS"):WaitForChild("MSAddLog")


BindableEvent.Event:Connect(function(UserName, theCommand)
	local StartCords = script.StartCords.Value -- 003
	local StartCanvas = script.StartCanvas.Value -- 10
	local TextSetNumber = script.TextSetNumber.Value -- is 10 is 18
	local item = script.TextLabel:Clone()
	 item.Name = TextSetNumber
	
     item.Text = UserName.." | "..theCommand
	item.Position = UDim2.new(0,003,0,tonumber(StartCords))

	 item.Parent = script.Parent.Frame.ScrollingFrame
	 script.Parent.Frame.ScrollingFrame.CanvasSize = UDim2.new(0,0,StartCanvas,0)
	 script.StartCords.Value = tonumber(script.StartCords.Value + 28)

	 script.TextSetNumber.Value = script.TextSetNumber.Value + 1
	 if TextSetNumber > 18 then
		script.StartCanvas.Value = script.StartCanvas.Value + 0.5
	 end
end)

--game.ReplicatedStorage.MSAddLog:Fire("Med367367","test")

And this is the error with my frist try, the line are not good and the scrollGui just don’t update

local BindableEvent = game.ReplicatedStorage:WaitForChild("MS"):WaitForChild("MSAddLog")

local grid = Instance.new("UIGridLayout")
grid.CellPadding = UDim2.new(0, 0, 0, 0)
grid.CellSize = UDim2.new(0, 100, 0, 100)
grid.Parent = script.Parent.Frame.ScrollingFrame

    local function onContentSizeChanged()
    	local absoluteSize = grid.AbsoluteContentSize
    	script.Parent.Frame.ScrollingFrame.CanvasSize = UDim2.new(0, absoluteSize.X, 0, absoluteSize.Y)
    end
     
    grid:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(onContentSizeChanged)


BindableEvent.Event:Connect(function(UserName, theCommand)
	local StartCords = script.StartCords.Value -- 003
	local StartCanvas = script.StartCanvas.Value -- 10
	local TextSetNumber = script.TextSetNumber.Value -- is 10 is 18
	local item = script.TextLabel:Clone()
	 item.Name = TextSetNumber
	
     item.Text = UserName.." | "..theCommand
	 --item.Position = UDim2.new(0,003,0,tonumber(StartCords))

	 item.Parent = script.Parent.Frame.ScrollingFrame
	 --script.Parent.Frame.ScrollingFrame.CanvasSize = UDim2.new(0,0,StartCanvas,0)
	 --script.StartCords.Value = tonumber(script.StartCords.Value + 28)

	 script.TextSetNumber.Value = script.TextSetNumber.Value + 1
	 --if TextSetNumber > 18 then
		-- script.StartCanvas.Value = script.StartCanvas.Value + 0.5
	 --end
end)

--game.ReplicatedStorage.MSAddLog:Fire("Med367367","test")

@Med367367 You can do this using the CanvasPosition property, to make it go all the way to the bottom you can do

local scrollingFrame = script.Parent 
while true do
wait(.5)
scrollingFrame.CanvasPosition = vector2.new(0, 999999) 
 end

I do not suggest using the while loop though, as it will run forever and use up unnecessary “speed”, Instead you can just run the code in the while loop whenever something is added to the scrolling frame, just take out the wait(.5). Hope this helped. :smiley:

1 Like

I am not sure I understood what you are explaining, the script which does not work better but I believe that it had to enlarge the scroll bar what I was already doing at the beginning but which caused me a problem with the because it was getting too big

Can you try explaining the problem again because I couldn’t really understand. I thought you were saying whenever you add something to the scrolling frame that it wouldn’t automatically scroll down to the bottom.