Shifting children on a scrolling frame upon adding a child

Hey y’all,

I’m writing a member list GUI for moderators so they can easily view a player’s reputation (warnings, etc.) along with some options to kick, ban, and unban.

I’m using a scrolling frame to display the member list; however, I’m unsure of what to do since I use the scale/offset values interchangeably for this to be compatible on any device without having to write too much code.

Here’s a part of my current script:

for index, user in pairs(users:GetChildren()) do
    user.Position += UDim2.new(0, 0, 0, ModGui.List.Modal.Size.Y.Scale * ModGui.List.AbsolutePosition.Y)
        if user.AbsolutePosition.Y > ModGui.List.Users.AbsoluteCanvasSize.Y then
            ModGui.List.Users.CanvasSize += UDim2.new(0, 0, 0, ModGui.List.Modal.AbsoluteSize.Y / 1.5)
    end
end

If anyone here knows anything on how to (more easily) shift all items in a frame to make room for the new item, that would greatly help my poor, sleep deprived brain.

The issue with this is that the items go offscreen every time I unshift the remaining items after removing an item.

I haven’t found any solutions as of yet. I’ll add more details at a later date (when I’m not deprived of sleep), or upon request.

Cheers,
Calculamatrise

You can add in your frame an instance called “UIList”. It basically does what you want to do, but automatically, without any code.