Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a script that plays a sound in StarterGui, but accesses PlayerGui?

Asked by 10 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

This is a followup to a question I had asked earlier: How do I make a sound play for a single player when they join? I got a comment saying that I had to do this: Okay, so to make it play for the player when they join, you will need to place the sound inside the StarterGui and then have a script play it when the join, except you will access it as PlayerGui. I havn't the faintest idea where to start with that, could someone post the script, or at least point me in the right direction?

1 answer

Log in to vote
1
Answered by
Sublimus 992 Moderation Voter
10 years ago

Insert a sound into the StarterGui, then, have this script in the workspace:

game.Players.PlayerAdded:connect(function(player)
    repeat wait() until player:findFirstChild("PlayerGui") -- Waits for PlayerGui to load
    player.PlayerGui.Sound:Play()
end)
Ad

Answer this question