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

PlayerGui::GetGuiObjectsAtPosition returns empty table ?

Asked by 2 years ago
Edited by Xapelize 2 years ago

For some reason, when calling GetGuiObjectsAtPosition, all it returns is an empty table ("{}") even though there's clearly a frame with size {1, 0}, {1, 0} in the middle of the screen.

Ran in LocalScript

game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):GetGuiObjectsAtPosition(50, 50)

But when I run the same exact thing in the command bar while playing, it returns what's expected.

1 answer

Log in to vote
0
Answered by
Xeqro 20
2 years ago

Have you tried putting a wait before printing out the results? I did and it worked. Pretty sure you ran the script before the frame has loaded?

0
no monke instead wait for the frame using WaitForChild or create the whole gui using script, that way you always know that it exists, if you want the gui to be created in studio, put the ScreenGui into ReplicatedStorage and :Clone it into player's PlayerGui, that will make it always replicated and stop spreading ::colon::cancer >:v imKirda 4491 — 2y
0
ok whatever yes Xeqro 20 — 2y
Ad

Answer this question