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

[SOLVED] Music/Audio that will play when a certain/selected player joins?

I have been trying multiple scripts to play an audio when a certain player joins (me) but none works, They are probably outdated.

So I will ask if anyone could create a script that WORKS for the latest Roblox Studio version, Also should I use Script or LocalScript ?

The old and "outdated" question with scripts you can get and modify (None of the scripts there work): https://scriptinghelpers.org/questions/36847/audio-that-plays-when-certain-player-enters

3 answers

✓ Accepted answer

Hello! I made a script for you:

local Sound = game.Workspace:WaitForChild("Sound")
local Players = {"Player1","Playe2","JakyeRU"}

game.Players.PlayerAdded:Connect(function(player)
	for i, v in pairs(Players) do
		if player.Name == v then
			Sound:Play()
		end
	end
end)

6 comments

0

*Note that you can add more than 3 players in the table Players!

0

Thanks!

0

At "Sound" should I replace Sound with Audio ID or the Audio Name?

0

Your sound location. For example: game.Workspace.Sound. (WaitForChild waits for the Sound to be loaded)

0

To insert a sound do: Right Click on Workspace, Insert Object, Sound. Change the Sound ID in properties.

0

Ooh, Thanks so much!

It's simple, make a script in SSS(ServerScriptService) and make a PlayerAdded function that verifies if the player that joined's name is the name of the player you want to play the audio when joined.

local players = game:GetService("Players")
local starterGUI = game:GetService("StarterGui")

local audio = starterGUI:WaitForChild("Audio") --//Pretend it's there

players.PlayerAdded:Connect(function(player)
	if player.Name == "[InsertPlayerNameHere]" then
		audio:Play()
	end
end)

P.S: If you want the audio to play for everyone, then put it in StarterGui, else put it somewhere else.

4 comments

0

Thank you!!! Keep track on this one if I ask some quetsions.

0

One question, You told me to add it to SSS.Then told me to add it in StarterGui? I wan't it to play it for everyone so SSS or StarterGui?

0
0

Okay okay, This is right? http://prntscr.com/mpyw6a

None of above works.

2 comments

0

I maybe do it wrong, But I replace "sound" with Sound ID and player name with my Name. Then I join the game but I hear no music.. I wan't everyone to hear it.

0

You understood it wrong, you put the script in SSS and the audio in StarterGui

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