I have a TextLabel object, which I want to resize depending on the distance between 2 Vector3s. Nothing else really, how would I begin? (As in the text label is very small if far and text label is big if close)
What exactly is this for? Is the gui object on the screen or on the part via a SurfaceGui?
Maybe you just want to find the distance between two Vector3s and set the Size of the TextLabel to the distance?
If you want the distance of two vectors, this is how:
local v1 = ...
local v2 = ...
local dist = (v2 - v1).Magnitude
I’ve been working on a caption system like found in the game Baldi’s Basics Classic Remastered, and I want a “caption” to size down if getting futher and size up if getting closer. I know how to get Distance, I just don’t know how to implement it correctly into a GUI Object.
Ah, I see. The Size property of the TextLabel is a UDim2. I think you might be able to multiply a UDim2 by the distance to increase/decrease the size. (But make sure to divide the distance by some factor, otherwise it would be to large)
Or, you can use UDim2.fromOffset
and pass the distance to it. You’ll probably need to set inital sizes as well
TL.Size = UDim2.fromOffset(100 + dist, 20 + dist)
Will try something like this, and see if I can get it working well.