I need help with Canva Size (UIGridLayout)

Hello DevForum! I’ve been working on my game, trying to do a Message System.

This is basically how the Message System works:
Players can send direct messages to others, like DMs.

Now, the thing is that every frame (that contains a TextLabel with the message) gets inside a scrolling frame, if more messages, more bigger the Canva Size will be. Here’s the problem:

As you can see, it doesn’t really fit well on the Scrolling Frame. (No error in Output btw)

UIGridLayout: --Inside Scrolling Frame

  • CellPadding: {0, 0},{0, 0}
  • CellSize = {0.9, 0},{0.12, 0}

Frame (Message Bubbles):

  • UIAspectRatioConstraint (Aspect Ratio) = 4.58
  • AspectType = FitWithinMaxSize
  • DominantAxis = Width

I didn’t really tried an solution so far, so any help will be appreciated.

Also, here’s another weird thing that happens:

local InventoryFrame = script.Parent.ScrollingFrame

InventoryFrame.ChildAdded:Connect(function()
	InventoryFrame.CanvasSize = UDim2.new(0, 0, 0, InventoryFrame.UIGridLayout.AbsoluteContentSize.Y + 400)
end)

InventoryFrame.ChildRemoved:Connect(function()
	InventoryFrame.CanvasSize = UDim2.new(0, 0, 0, InventoryFrame.UIGridLayout.AbsoluteContentSize.Y + 400)
end)

if you got any idea of how I can possibly fix this, please tell me. Thank you so much. :slight_smile:

1 Like

I think you need to turn automatic canvas size on in the scrolling frame then just test if offset or scale works best with the frames

1 Like

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