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.
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)
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