Gui is not a valid member of player, but it is?

! Alright, this is a bit weird. The error is

CameraGui is not a valid member of PlayerGui “Players.Spiyder1.PlayerGui”

Not really sure what to say, only that maybe the game isn’t recognizing it, but I am not really sure. I also have clicked on the error massage to confirm what script is it comming from, and it is this script:

script.Parent.Teleport.Parent = game.Workspace
--script.Parent.TeleportPart.Parent = game.Workspace

game.Players.PlayerAdded:connect(function(player)
	script.Parent.TextButton:Clone().Parent = player.PlayerGui.CameraGui.lol
end)

You can also upload photos here so here is the workspace + error if youre curios

testing - Roblox Studio 4_30_2021 8_44_35 PM_LI (2)|690x365

1 Like

This is a common issue, you basically just have to wait for it to load in
the script runs faster than the player loading in basically so you have to let the loading catch up with the script.

script.Parent.Teleport.Parent = game.Workspace
--script.Parent.TeleportPart.Parent = game.Workspace

game.Players.PlayerAdded:connect(function(player)
    local CameraGui = player.PlayerGui:WaitForChild("CameraGui")
    local lol = CameraGui:WaitForChild("lol")
	script.Parent.TextButton:Clone().Parent = lol
end)
1 Like

That was really fast. Thanks for that

1 Like

You don’t need to add a PlayerAdded event the moment a player joins the game, the LocalScript will already handle when a Player first joins the game

script.Parent.Teleport.Parent = game.Workspace
--script.Parent.TeleportPart.Parent = game.Workspace
local Player = game.Players.LocalPlayer
local CamGui = Player:WaitForChild("PlayerGui"):WaitForChild("CameraGui")

script.Parent.TextButton:Clone().Parent = CameraGui:WaitForChild("lol")
1 Like