I need this script to play a sound for someone who just joined and only once. I have a sound with the ID set in the StarterGUI file.
local player = game.Players.PlayerAdded:connect(function(player)
local sound = player.PlayerGui.Sound
sound:Play()
end)

3 comments
Use WaitForChild for every descendant of player. i.e. local sound = player:WaitForChild("PlayerGui"):WaitForChild("Sound")
You should post that as an answer, it worked.
Sure.