Where FirstGrid is the most top-left grid to position the ItemFrame on.
function InventoryUI:PositionToSpace(ItemFrame, FirstGrid)
local FirstGrid = tonumber(FirstGrid.Name) + 1 -- Add one as the first child of backpack is UILayout
local pos = BackpackGrid:GetChildren()[FirstGrid].AbsolutePosition - ItemFrame.Parent.Grid.AbsolutePosition
return UDim2.fromOffset(pos.X, pos.Y)
end
As you can see from the image, this works perfectly fine on my current screen size, and the button is placed exactly over the first square.
The button isn’t positioned in the correct square.
The individual squares as well as the button uses offset for their size and position. I won’t be able to change this as otherwise the scrollingframe won’t work properly on different sized screens.
I would say use FromScale but you said it didn’t work. Why exactly didn’t just using FromScale work and how does it break scrolling frame because I haven’t had any problem like that with scrolling frame
Since the button is being added whenever the player picks up an item, it’s created through a script.
And because of that, I’m unable to properly convert the button from offset to scale. You can see my problem here.
Also, I prefer it to do this on smaller screens, rather than having the individual grids scale down to fit the screen.
Ok all I could figure out is that in this example that you posted is https://gyazo.com/61fab2c3e0bcff1b1c0729a024c59274
that the item is offset from the first square by the same width as the scroll bar