The white frames are an indicator actually where is the ImageButton based on its AbsolutePosition.
And the translucent black frames are where the actual ImageButton are.
This is a problem when I wanted to know if what button is the cursor on.
This is when i drag to the slot number 2.
Extra info:
function get_button_from_position(pos: Vector2): ImageButton?
for _, button in (inventorySlots:GetChildren()):: {ImageButton} do
if not button:IsA("ImageButton") then
continue
end
-- Calculate the bounding box of the button
local p1 = button.AbsolutePosition -- Top-left corner
local p2 = p1 + button.AbsoluteSize -- Bottom-right corner
-- Check if the position is within the bounding box
if (pos.X >= p1.X) and (pos.X <= p2.X) and (pos.Y >= p1.Y) and (pos.Y <= p2.Y) then
return button;
end
end
return nil
end
Command ran in the Command Bar: b=game.StarterGui.InventoryStorage.InventoryFrame.InventorySlots;x=b.Parent.Parent;for _, v in b:GetChildren() do if v:IsA("ImageButton") then local c = Instance.new("Frame"); c.Parent, c.Size, c.Position = x, UDim2.fromOffset(v.AbsoluteSize.X, v.AbsoluteSize.Y) , UDim2.fromOffset(v.AbsolutePosition.X, v.AbsolutePosition.Y) end end print("h")
Command ran in the Command Bar: b=game.Players.DiscoDino01.PlayerGui.InventoryStorage.InventoryFrame.InventorySlots;x=b.Parent.Parent;for _, v in b:GetChildren() do if v:IsA("ImageButton") then local c = Instance.new("Frame"); c.Parent, c.Size, c.Position = x, UDim2.fromOffset(v.AbsoluteSize.X, v.AbsoluteSize.Y) , UDim2.fromOffset(v.AbsolutePosition.X, v.AbsolutePosition.Y) end end print("h")
replicated the issue on a new place and the absolute position of the Frame and the ImageButton doesn’t match but the Frame UDim2 Position does match the ImageButton’s AbsolutePosition.