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

(Answered) How to make a script that runs when a player joins a game?

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.

2 comments

0

i edited my answer to your situation

0

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.

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

0

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.

0

what is in output. Did you take the 1 off the end of the sound?

0

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

0

try adding a wait before it plays

0

Thankyou! It works!

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