Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

PlayerGui::GetGuiObjectsAtPosition returns empty table ?

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

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?

2 comments

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

0

ok whatever yes

This discussion is preserved as it was. New answers, comments, and votes are closed.