Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a sound play for a single player when they join?

So I want a sound to play for a player, everytime they join the game. However, with the way I did it, the sound plays for everyone, not the player who just joined the game. This is the code I used to play the sound file, and it is a localscript

Game.Workspace.Sound:Play()

4 answers

✓ Accepted answer

Place the sound inside of the PlayerGui and play it from there.

3 comments

1

My good sir, you help me so much with my game. Someones getting free VIP. (P.S. It's you.)

0

Dumb question though, where is player GUI. I'm using the old studio version, not the new ribbon bar one.

1

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

You could also change the source of the LocalScript to the following: local base=game:service'Lighting'.Join_Sound:clone();--Place the sound in Lighting and rename it to Join_Sound base=base:clone(); base.Parent=game:service'Workspace'.currentCamera; base:play();

game.Players.PlayerAdded:connect( function(plr)
   newsound = game.Workspace.Sound:clone()
   newsound.Parent = plr.PlayerGui
   newsound:play()
end)

I think that's it... basically this does

When new player joins: Copy the sound into a new sound Put the new sound into the player's playergui Play the new sound.

Might be some problems with it, but try it :P

5 comments

1

Oh whoops. Huner replied with a better way :P

0

I can't find player playergui, if I click player in the explorer, nothing happens. There is nothing inside of player.

0

That's because Players is just where it puts the players WHEN THEY JOIN the game. So you have to have a script that does something when a player joins.

0

Ooh, that makes sense. Do you have any idea how I should go about making that script?

0

Ya, the one in my answer

playergui is located under the Players > YOURNAME > PlayerGui

2 comments

0

Players is just empty for me. My name isn't in there, or anything for that matter.

0

are you in edit mode?

This discussion is preserved as it was. New answers, comments, and votes are closed.