LocalPlayer.PlayerGui is nil

i seriously do not know how to fix this
in studio, there are zero errors whatsoever, and gui’s are fine. but in roblox, gui’s don’t work, and everything parented to a gui or startergui (same as playergui) says its parent is nil


in roblox immediately after publishing the place,

here’s those scripts (up to the line they error):

-- ChangeSize
local textService = game:GetService("TextService")
local label = script.Parent:WaitForChild("TextLabel") -- attempt to index nil with WaitForChild
-- enabler
script.Parent.Enabled = true -- attempt to index nil with Enabled
script:Destroy()
-- literally just so that you don't have it while in studio

and its not even consistent
sometimes when i join it shows different errors, for example this one??


we’ve tried WaitForChild on PlayerGui and it just hangs infinitely

oh and just to add to it sometimes this happens


i do not have any scripts named either of those, neither of them are mine (and even if i search in the explorer they don’t come up)
but that only happens like 1/4th of the time

im starting to believe my scripts are cursed when script.Parent is nil

3 Likes

maybe you have something like one of those anticheat free models that parents local scripts to nil?

we don’t have any free models
at all

That is Roblox’s Core Modules. It’s not important at all, it happens to almost everyone. As far as I’m aware nothing goes wrong whenever that pops up.

Have you tried outputting the Instance.Parent property and confirm that it is not what you wanted?

i tested these a bit more, and it turns out i straight up just don’t have a Player.PlayerGui
every instance inside startergui is parented to nil (yet the scripts still run…? but all guis are invisible / destroyed) and if i print every instance inside player it doesn’t print PlayerGui

(its not like i’m trying to access another player’s gui, i’m trying to access my own playergui from a localscript.)

1 Like

What is Players.CharacterAutoLoads set to? If you add a print(script:GetFullName()), what is the output?

CharacterAutoLoads is true, printing that prints “LocalScript”
i can’t imagine that the character would be making a difference here, none of these scripts are inside startercharacter or even reference the character before that line

This error occurs to me a lot because of network issues, It happens when the script loads before the other instance

-- ChangeSize
local textService = game:GetService("TextService")
local label = script.Parent:WaitForChild("TextLabel", 999) -- attempt to index nil with WaitForChild

changing the timeout to something high like 60 or 999 or ∞ fixes the issues for me

1 Like

no, it’s not the thing trying to access it before its loaded, the playergui just doesn’t exist at all
all the gui’s i put in startergui are just entirely voided


all of these are enabled by default and work fine in studio,
if i then play the game,

Maybe you accidentally disabled ‘Archivable’ on StarterGui?

1 Like

checked that already, startergui still has archivable

okay i fixed it, my friend (who is also making this with me) created a script that accidentally destroyed the entire playergui (rather than just the gui it was supposed to destroy) when it wasn’t in studio

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.