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

Why is Script not accessing gui even though its there?

The problem is that the output says that the gui isnt thier even though the gui is in the startergui and yes the name is correct, this is a regular script and the place is fe

i hve tried :FindFirstChild() & :WaitForChild() and they don't work

	local PlyrName = Part.Parent.Name
	local guiname = 'Effects'
	print(PlyrName)	
	local player = game.Players:FindFirstChild(PlyrName) 
	local PlayerGui = player:FindFirstChild('PlayerGui').Gui

	--error(Gui isnt a member of playergui)

3 comments

0

Add a wait() at the start of the script, then try again.

0

I'm not sure about FilteringEnabled, but use LocalScript.

0

make sure it is local and the "Gui" screenGui instance is called EXACTLY the same e.g if its called gui you can't search for it as Gui

1 answer

✓ Accepted answer

What your doing is wrong, you used :FindFirstChild in the wrong way. And you don't need to use :FindFirstChild() or WaitForChild() with the PlayerGui because once the player is loaded the player Gui is there 100%. This is what your script should look like;

local PlyrName = Part.Parent.Name
local guiname = 'Effects'
print(PlyrName) 
local player = game.Players:FindFirstChild(PlyrName) 
local PlayerGui = player.PlayerGui:WaitForChild('Gui')

I'm not sure if FE will interfere but you use WaitForChild in order to wait for the Gui to load.

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