Check If Gui Object Is Visible In ScrollingFrame?

Hello there!

I’ve been facing this problem for a while now. If you didn’t know, when you play videos with the video instance in your game, only 2 are allowed to be played at the same time. I want to check if a GUI Object (doesn’t have to be a video) is visible in a ScrollingFrame, so I can make it play or not if it is visible.

I have no clue where to begin. Anything will be great! :grinning_face_with_smiling_eyes:

I don’t know if this is worth mentioning, but in the ScrollingFrame there is a UIListLayout with 0 padding

4 Likes

Rectangular GUI objects can be seens as axis-aligned boxes. Say gui object A is a child of gui object B which has ClipsDescendants on. Checking if A is visible inside the “window” of B is like checking if any part of A is inside of B, or checking if they’re colliding in other words. Luckily it’s really easy to do collision between axis-aligned boxes. Check out this tutorial, and feel free to ask if you have any other questions:

https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection

1 Like

Could you maybe elaborate?

When you say visible, do you mean the Visible property or if a player is scrolled to that section on the frame where the video is at?

Scrolled to the section in the ScrollingFrame

I will look into this. Thanks!

1 Like