I presume it needs the script to calculate the distance required for the white line horizontally and vertically depending on the distance between the two buttons but how???
Assuming that you are trying to do something similar to the image you provided…
I’m not a scripter but if the distance is going to be constant, couldn’t you just have a static UI element that appears or disappears when necessary? This is assuming the two things you want to connect are going to be in the same place every time.
I would recommend searching tutorials on how the game was made. But it looks like instead of calculating an entire line, it calculates it in parts, probably using the same calculation method as the placement of the tiles.