I tried making a line that follows one point to your mouse, but it worked when i used it on two parts but because the center of a gui is in the left corner it was very wierd. I have tried fixing in a multiple ways it but none worked.
01 | mouse = script.Parent.Parent.Parent.Parent:GetMouse() |
02 | node = script.Parent.Parent.Frame.Nodein 1 |
03 | line = script.Parent |
04 |
05 | function move() |
06 | local x 1 = node.AbsolutePosition.X+ 25 |
07 | local y 1 = node.AbsolutePosition.Y+ 25 |
08 | local x 2 = mouse.X |
09 | local y 2 = mouse.Y |
10 | local deg = math.atan 2 (y 1 -y 2 ,x 1 -x 2 )* 180.0 /math.pi |
11 | line.Size = UDim 2. new( 0 ,math.sqrt((x 2 -x 1 )*(x 2 -x 1 )+(y 2 -y 1 )*(y 2 -y 1 )), 0 , 10 ) |
12 | line.Position = UDim 2. new( 0 ,(x 1 +x 2 )/ 2 - 5 , 0 ,(y 1 +y 2 )/ 2 - 5 ) |
13 | line.Rotation = deg |
14 | print (deg) |
15 | end |
16 |
17 | mouse.Move:connect(move) |
I already had a problem similar to yours and it seems like you can't do maths with UDim2 you would more need to use the tweenposition instead of math.If you have any question comment my answer and i will respond to you as fats as i can.Hope i helped you! ;)
link: http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenPosition