Can't Access A Frame In Player Gui

I am trying to access a frame in PlayerGui in a local script. It is not working though.
Local script:

local Event = game:GetService("ReplicatedStorage"):WaitForChild("BlackFade")
local Player = game:GetService("Players").LocalPlayer
local theplayer = game.Players.LocalPlayer

local Fade2 = Player.PlayerGui.WhiteFade.tframe

local Info = TweenInfo.new(3)
local tween = game:GetService("TweenService"):Create(Fade2,Info,{BackgroundTransparency=0})
local close = game:GetService("TweenService"):Create(Fade2,Info,{BackgroundTransparency=1})

It says:

WhiteFade is not a valid member of PlayerGui "Players.wes_youtuber.PlayerGui" 

Help is appreciated. :slight_smile:

2 thing

  1. Check if you actual has written the right names in the right places
  2. Use WaitForChild on playergui and maybe also the WhiteFade

-Lfm_Ninja

1 Like

Make sure you use :WaitForChild()

1 Like