Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Getting the position of a Image Button inside of a billboard GUI using InputBegan dosen't work?

Asked by 1 year ago
Edited 1 year ago

So I just realized that getting the position of a 2D GUI perfectly works and it is accurate however when I try and get the position of a ImageButton inside of a billboard GUI it is not accurate

Heres an example

I press an Image using a

Input began event

2D Image Button Script

ImageButton.InputBegan:Connect(function(Input)
    print(Input.Position)

end)

WORKS PERFECTLY FINE AND RETURNS THE MOUSE OR TOUCH PIXELS

The vector3 value of where the mouse is

510,432,0

I did the same with a ImageButton under a billboard GUI which resulted in

ImageButton.InputBegan:Connect(function(Input)
    print(Input.Position)

end)

This returned a different value and a much smaller value of

13, 57, 0

and we know this is not accurate because this would mean that the mouse would be at the very little corner which is almost impossible because my computer is 2000 pixels and you know how small 13 pixels is compared to 2000 pixels

So basically

To be more specific im talking about screen pixel size

For example a 2D GUI would have a screen pixel position of something like 240, 50 depending on where you pick

1 answer

Log in to vote
0
Answered by
Puppynniko 1059 Moderation Voter
1 year ago

From what i know the Billboard position is relative to the top left Corner so you need to add the position of the BillBoard position

0
And How would I get the position of the billboard? Overseer_Prince 188 — 1y
0
Tbh what Im trying to do is Determine how far I moved from the original position of where I clicked on a billboard gui button Overseer_Prince 188 — 1y
0
Also can you not use UserInputService:GetMouseLocation() and the reason I discourage this function is because for some reason every single time there's an offset meaning that this function is not accurate as inputobject.position Overseer_Prince 188 — 1y
0
using UserInputService:GetMouseLocation() is fine you just have to add the offset to the location Puppynniko 1059 — 1y
Ad

Answer this question