Sound Triggers When A Player Joins

Hello, I am trying to create a script that when a player joins, a Sound or Audio Asset gets played. here is what I am after:

  • What are you attempting to achieve? (Keep it simple and clear)
    A simple welcome sound that when a player joins the game

  • What is the issue? (Keep it simple and clear - Include screenshots/videos/GIFs if possible)
    I have tried adding the SoundID inside the Sound Object but that did not work.

  • What solutions have you tried so far? (Have you searched for solutions through the Roblox Wiki yet?)
    I have tried to say:

    game.Players.PlayerAdded:Connect(function(player)
    local sound1 = 398159550
    end)

But that did not work at all. I have also tried looking up on YouTube about this but no luck on that. Nothing on the forums as well.

  • Further Details:
    No futher details. I will design the rest of the system.

You should add
sound1:Play()

This may be wrong btw…

Good luck!:joy:

Rundown


game.Players.PlayerAdded:Connect(function(player)
     local sound1 = 398159550 -- this only gives "sound1" the value 398159550
end)

Consider creating a sound instance first:

local Players = game:GetService("Players")

local welcomeSound = Instance.new("Sound")
welcomeSound.SoundId = "rbxassetid://398159550"
welcomeSound.Parent = workspace -- parented to Workspace

Players.PlayerAdded:Connect(function()
    welcomeSound:Play()
end)
8 Likes

This section isn’t for requesting scripts and you should make note of that. I’ll be helpful in this instance but in the future please refrain from requesting scripts to be written for you. That is not what this section is for.

local soundId = 0 -- Your Sound's ID Goes here

local Sound = Instance.new('Sound') -- Making a new sound instance
Sound.Name = 'PlayerJoinSound' -- Naming it for reference
Sound.Volume = 1 -- Upping the volume to 1 from the default .5
Sound.SoundId = 'rbxassetid://'..soundId -- Setting the assetId from above
Sound.Parent = workspace -- Finally parenting it to workspace

game.Players.PlayerAdded:Connect(function(player) -- When a player joins, feed into this function
	Sound:Play() -- Play the sound.
end)

1 Like

Thank you all for the help and I am really sorry for asking for scripts, I wanted to learn myself but unfortunatly, I could not find any Learning Resources and therefor am I unable to know what to do

https://studioplus.codekingdoms.com/en

This above link is a really good learning resource from what I’ve heard. I’d recommend trying it if you’re looking to begin learning scripting.

Thank you so much. It will really help me.