:GetService() or :WaitForChild()?

I have some variables, one being getting PlayerGui in a player, however I don’t know if its :WaitForChild() or :GetService()?

For example:
wait()

local Player = game.Players.LocalPlayer

local PlayerGui = Player:GetService("PlayerGui") -- or is it 
Player:WaitForChild("PlayerGui")

local Name = Player.Name

Use instance:WaitForChild. game:GetService is used to get services, which are singletons that perform a specific task. PlayerGui is not a service.

2 Likes

so Player:WaitForChild(“”)?

Player:WaitForChild("PlayerGui"), yes

2 Likes