I want a string-like part to stay on another part, kind of like an ESP.
How can I get the string's Y variable to connect to the part? (So the string will be on the part)
I'm assuming you would subtract the size and position? Idfk.
Changing it's position v
part1.Position = Vector3.new(part1.Position.X,part2.Position.Y - (part1.Size.Y/2),part1.Position.Z)
Equation:
Let's say the position.Y
value of part2 is 50. The size.Y
value of part1 is 10.
Parts' positions are in their exact middle, so you take away half of their's size, so:
50 - 5 = 45
That is the position you get.
Note: This only works properly for parts in line vertically. I'm gonna do some testing to see if I can do this with CFrame.
Changing it's size v
local mag = (part1.Position - part2.Position).magnitude string.Size = Vector3.new(string.Size.X,mag,string.Size.Z)
Line 1 gets the distance between part1
and part2
. string
is the string you wanted.
Line 2 resizes it.