I’m trying to make a viewport frame act as a button. So I am deciding to use AABB collision. The issue is that I think I am getting the logic wrong. Here is my code. How do I fix my if statement?
mouse.Move:Connect(function()
if script.Parent.InventoryBackground.Visible then
for _, v in ipairs(script.Parent.InventoryBackground.InventoryContainer:GetDescendants()) do
if v:IsA("ViewportFrame") then
if v.Position.X.Offset < mouse.X and v.Position.X.Offset + v.Size.X.Offset > mouse.X and v.Position.Y.Offset < mouse.Y and v.Position.Y.Offset + v.Size.Y.Offset > mouse.Y then
print("Over")
end
end
end
end
end)