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

How do you check if there is a Gui inside the PlayerGui?

Asked by 7 years ago

I tried using this: if plyr.PlayerGui.SpeechGuiNPC01 ~= nil then

But it didn't work. I'm trying to make sure this specific Gui is not inside of the PlayerGui before it performs an action. How should I rewrite this?

1 answer

Log in to vote
1
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
7 years ago

Your best bet would be to use FindFirstChild.

if not player.PlayerGui:FindFirstChild('SpeechGuiNPC01') then
    --// Do stuff
end;

Hope this helped.
Read more about logical operators (such as not).

Ad

Answer this question