Need To Get World Position For SurfaceGui ImageLabel

Hello!

The title sort of explains it. I have a SurfaceGui on a part (obviously), and I’m trying to get the world position of the ImageLabel under the SurfaceGui. Is this possible? And if it is, how can I do it? Below is the ImageLabel I’d need to get the world position of (and the position changes, so it’s not a one time thing).

I’ve looked everywhere and can’t find a solution. Any help is appreciated. Thanks!

3 Likes

No, I don’t think it is possible. Anyone, feel free to correct me. You’d have to grab the world position of the part. What are you trying to do with the image label?

Do you think it’s possible to get the ImageLabel’s world position by using the part’s world position, if that makes sense?

And essentially, I wanna do a raycast from the ImageLabel, and to do that I obviously need it’s world position.

Oh, I see. From my understanding, the ImageLabel has only a part position, or where it is on the part. What you could do is make the part smaller to fit the image label, or make the image label size, “{1, 0},{1, 0}”. Setting the Image Label size to that will make it fill up the entire part. If you can’t change the part size, then make another part, and scale it to the ImageLabel, and group them together as a model.

Let me know if this helps or not.

Are you trying to get the Vector2 or Vector3 position?

1 Like

Guess by “World position” he meant by Vector3.

1 Like

I’ve thought about it and figured it out on my own.

For anyone else that might run into this problem, you can just divide the ImageLabel’s X and Y positions on the part/SurfaceGui by the SurfaceGui’s studs per pixel (in my case, it’s 50). This will give you the distance from the top left of the SurfaceGui. That’s enough to be able to get the ImageLabel’s world position.

I was looking for the Vector3, preferably, but I got it. See my reply above.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.