Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

A song plays for a player while the introduction screen appears when player enters?

Asked by
RAYAN1565 691 Moderation Voter
10 years ago

So I want to add a song that plays only for the new player that enters the game, for about 42 seconds, which is how long the introduction GUI for the game is. I have the song already, but how should I do the script?

3 answers

Log in to vote
0
Answered by
acecateer 130
10 years ago
local time = 42 --How long you want it to play
Game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        local song = Workspace.Song
        local clone = song:Clone()
        clone.Parent = plr --This makes the sound play locally inside of the player.
        clone:Play()
        wait(time)
        repeat
        wait()
        clone:Stop()
        until clone.IsPlaying == false --This makes sure the sound stops, roblox's sound system is a bit messed up (as of, last time I checked)
    end)
end)
2
Thanks so much! Worked Perfectly. But do you have any idea on lowering the volume of the song until you can't hear it anymore? RAYAN1565 691 — 10y
0
Sounds have a property called 'Volume' 1 is basically the max volume an d0 is mute so lowering it in increments of 0.1 would be most effective. Use a loop to lower the volume gradually. acecateer 130 — 10y
Ad
Log in to vote
0
Answered by 10 years ago
local song = Workspace.Music --Put this to wherever your song file is.
song:Play() --Use the play function to start the song.
wait(42) --You can change this to a little more or a little less depending on how it works with your intro.
song:Stop() --Stops the music with the Stop function.

Hope this helps! :)

1
I want it to only play the song for that player that enters though. I don't want it to play for the whole server. Do you have any idea on doing that? RAYAN1565 691 — 10y
0
I would insert the song into the player's head who entered. Then, I would use the script above. RedneckBane 100 — 10y
Log in to vote
-1
Answered by 10 years ago
local song = Workspace.Music --Put this to wherever your song file is.

game.Players.PlayerAdded:connect(function()
wait()
song:Play() --Use the play function to start the song.

wait(42) --You can change this to a little more or a little less depending on how it works with your intro.

song:Stop() --Stops the music with the Stop function.
end --You may need more ends

Answer this question