Player Added Event sound not playing

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to figure out why my script is not playing the sound when a player joins.

  2. What is the issue? Include screenshots / videos if possible! The sound is not playing even though it is in the script

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? i tried to debug this for a few

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

game.Players:WaitForChild("Sound")

local SoundId = 129322550
local SoundLocation = game.SoundService.Sound
local SoundVol = 3

game.Players.PlayerAdded:Connect(function(Player)
	wait(5)
	SoundId = SoundId
	SoundVol = SoundVol
	SoundLocation.Playing = true
	SoundLocation.Looped = true
	SoundLocation:Play(Player)
end)

Hello, so My script is not playing sound and i’m not sure why this is happening

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Before I start; it looks like you are accessing a Sound Instance inside of SoundService and are attempting to play it for a certain player since you have the following code Sound:Play(player) when playing a sound there should be no arguments ran into a sound as it doesn’t go to just one player. This seems like a serverscript meaning each time you run this sound it’s replicated to all players.

The game is most likely not running the PlayerAdded event for players who already are in game before the server started up or while it was starting up. What you need to do is something like this::

local Players = game:GetService("Players")

local function PlayerAdded(player: Player)
    -- your code here
end

for _, player in ipairs(Players:GetPlayers()) do
    task.spawn(PlayerAdded, player)
end
Players.PlayerAdded:Connect(PlayerAdded)

Also, I noticed that every time a player joins the same song is supposed to play on loop for each join. If this is music for a specific player consider creating a LocalScript and placing it inside StarterPlayerScripts and doing something more along the lines of this:

-- LocalScript
local SoundId = 129322550
local SoundLocation = game:GetService("SoundService"):WaitForChild("Sound")
local SoundVol = 3

SoundLocation.SoundId = SoundId
SoundLocation.Volume = SoundVol
SoundLocation.Looped = true
SoundLocation:Play()