Hey there. The title may sound a little weird, however let me explain…
With a script, I want to move the white line next to the button that the arrow is pointing to in this image:
Specifically changing the .Position isn’t an option because I’ve allowed users to be able to disable certain buttons, meaning that if a certain button was disabled, the indicator would be in the incorrect place.
Another reason why I can’t use a specific .Position is because I’d like to tackle the weird scaling that this line is doing. Here’s what I mean:
In-Game
Studio
Additionally, It may be worth noting that all my buttons have a UIListLayout.Thank you for taking time out of your day to help me, no matter how.
I’m not exactly sure as to why you’re saying that it isn’t lining up as it should always line up if within the same frame.
I believe that the problem is either that it is in a completely different frame and that frame is of different size or position, or you are using offset, which will be different for everyone and different between in-game and studio.
To fix this, if the latter, switch to scale for size and position, else, use them in the same frame or have that frame same Y size and Y position.
To move that UI to the same Y position to line up, I would do
You should listen for the change of AbsolutePosition/AbsoluteSize properties of currently selected button, then you should implement something like this:
(I am assuming you have a similar UI elements structure)
It could be done by tweening not the line, but a NumberValue which is a delta for offsetting the line vertically. So everytime player clicks a button the NumberValue.Value being tweened and the line will be offseted by this value, otherwise the line will look weird when resizing the game while the tween is happening.