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

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

Asked by 10 years ago

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

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

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

1
My good sir, you help me so much with my game. Someones getting free VIP. (P.S. It's you.) Tallestmidget7 95 — 10y
0
Dumb question though, where is player GUI. I'm using the old studio version, not the new ribbon bar one. Tallestmidget7 95 — 10y
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 Sublimus 992 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

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();

Log in to vote
0
Answered by 10 years ago
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

1
Oh whoops. Huner replied with a better way :P Nikola7007 25 — 10y
0
I can't find player playergui, if I click player in the explorer, nothing happens. There is nothing inside of player. Tallestmidget7 95 — 10y
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. Nikola7007 25 — 10y
0
Ooh, that makes sense. Do you have any idea how I should go about making that script? Tallestmidget7 95 — 10y
0
Ya, the one in my answer Nikola7007 25 — 10y
Log in to vote
-1
Answered by
yurhomi10 192
10 years ago

playergui is located under the Players > YOURNAME > PlayerGui

0
Players is just empty for me. My name isn't in there, or anything for that matter. Tallestmidget7 95 — 10y
0
are you in edit mode? yurhomi10 192 — 10y

Answer this question