I want to create a code that runs and only a specific player can here it. Almost like a intro script but instead when a player joins they here a specific music peice and then maybe it runs through a playlist of songs. I know how to run songs via scripts by the way.
(Answered) How to make a script that runs when a player joins a game?
1 answer
All you have to do is make a server script that says the following
game.Players.PlayerAdded:connect(function(player)
local sound = Instance.new("Sound")
sound.SoundId = "SOUND HERE"
sound.Parent = player.PlayerGui
sound:Play()
end)
this will fire when a player joins the game. this should only play the sound to the player that joined the game
5 comments
It seems this script does not play the sound. I have made sure to enter the sound id which is http://www.roblox.com/asset/?id=300733201. Also When I normally run sound scripts the local would usally be above the script though i tried that and it didn't make a difference.
what is in output. Did you take the 1 off the end of the sound?
The output says nothing about the sound. When I look in the player section with the player GUI a sound instance is their but its setting is paused. As well as the fact that I cannot here the sound at all. The script has all the apropriate numbers as well
try adding a wait before it plays
Thankyou! It works!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
i edited my answer to your situation
If someone answers your question, mark it as accepted by pressing the Check Mark next to their answer. Don't update the title of your question.