the problem with that is that it will give you the positon in the string (a single number) but not an actual position. but i dont know how i would convert that into an actual position
I see. I don’t think there is really a way to grab an absolute position of the Cursor itself unless you maybe did some type of math with the textbox’s TextBounds and AbsolutePosition?
The CursorPosition gives you the position relative to the text inside of the textbox. What would you need an AbsolutePosition of this for, if I may ask?
Referencing the topic @Crygen54 posted, this is essentially what you would have to do then, you just need to tinker and understand the math behind it.
It’ll depend on your text alignment, You essentially divide the TextBound X by the Absolute Size X of the TextBox in order to find your scale (position based on how much space has been filled up). The negative and divided by 2 is just to realign the frame for the purpose of the cursor being centered or to the right (let’s say we have ours to the left for ease).
local Scale = (textBox.TextBounds.X / textBox.AbsoluteSize.X)
Next comes the UDim2.fromScale() which is important because you want the actual scale of the frame’s position relative to the textbox (make sure your frame is inside your textbox). Now since we have nothing typed into the textbox, our x position will be set to 0 so that it will reside in UDim2.new(0, 0, 0, 0)
If you want to have a slight offset, you can just add 0.01 (or whatever value you want for spacing) to the X coordinate of the UDim2 and it should be offset so you can see your cursor. Hope this helps! :>
thank you so much for this reply but it wont work with vertically and the bigger problem is that it doesnt follow the text cursor rather it stays at the end of the text… im very sorry and thank you for your help
If you’re doing it vertically, then instead of the X coordinate you will have to manipulate the Y coordinate (it’s essentially the same thing just with Y instead of X). You’re very welcome btw and no need to apologize! I’m glad I can help you out. :>
Also if you mean have the frame like on the side then you’ll have to change X to a fixed value, because it does follow the cursor but without changing the other coordinate, it will just lay on top of the text + cursor.
I see, whenever you line break is when you need to change the Y value, not change it the full time. That’s my bad I didn’t fully understand what you wanted.
So basically you just manipulate the X coordinate whenever you type normally, and whenever you go to break a line, reset the X to where the cursor is and then manipulate the Y value. That should hopefully fix your issue.
I think people are overcomplicating this too much, you can just use mouse enter which returns the X and Y coordinate of the mouse’s position in pixels.