I’m trying to check if a player has gui and it keeps giving an error in the output that said it is not a valid member. I’m using:
if player.PlayerGui.Gui then
if you know how to fix it, please reply!
I’m trying to check if a player has gui and it keeps giving an error in the output that said it is not a valid member. I’m using:
if player.PlayerGui.Gui then
if you know how to fix it, please reply!
You always use :WaitForChild()
when getting the PlayerGui
via a LocalScript otherwise your code will cause errors:
local PlayerGui = Player:WaitForChild("PlayerGui")
Use FindFirstChild to see if a child is a member of a parent at the current instant.
if player.PlayerGui:FindFirstChild("Gui") then
or if it’s PlayerGui that’s not a valid member:
if player:WaitForChild("PlayerGui"):FindFirstChild("Gui") then
(if you’re handling this locally, you need to wait for playergui to load in on spawn)
Hmm… I tried it and it didn’t work!
Is ‘Gui’ even a valid member of PlayerGui
?
You may need to wait for both:
if player:WaitForChild("PlayerGui"):WaitForChild("Gui") then
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.