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

How do i play music when a player joins the game?

Asked by 10 years ago

So apparently I'm trying to make a script where if the part1 finished, it will play part2

local part1 = game.Workspace.Sound1.IsPlaying.False
local part2 = game.Workspace.Sound2.IsPlaying.False

game.Players.PlayerAdded:connect(function(player)
    game.Workspace.Sound1:Play()
end)

if part1 then
    game.Workspace.Sound2:play()
else
    if part2 then
        game.Workspace.Sound1:play()
    end
end

for _, player in pairs(game.Players:GetPlayers()) do
    PlayerAdded(connect) -- Use your player added handling function here.
end

This is the full script. The problem is, i can't get the sound to play whenever a player joins. As you can see, the part 1 and part 2 is called "Sound 1" and "Sound 2". Basically they are trying to play Smile HD [1/2] and [2/2] (placeholder music) then if part 2 finishes, part 1 will loop back again. I added the last paragraph of the script so it'll supposed to play in Solo Mode since the Wiki said it won't entirely work due to a bug or something. Anyone help? Maybe a little cleanup since i only know the basics of programming and not entirely the advanced of it.

1 answer

Log in to vote
0
Answered by 10 years ago

I'm not an expert but I think the problem is in the first 2 columns


local part1 = game.Workspace.Sound1:Stop() local part2 = game.Workspace.Sound2:Stop()

0
Im new to this site so I have problems writing scripts here chill22518 145 — 10y
0
Not really, the only problem i'm having is i can't play the sound whenever the player joins the game Eleenrei 0 — 10y
0
Oh ywah and by the way its chill22518 145 — 10y
0
game.Workspace.Sound1.IsPlaying = false and game.Workspace.Sound2.IsPlaying = false chill22518 145 — 10y
0
My problem is how can i play a sound when someone joins, I mind that part later. You're not helping >.< Eleenrei 0 — 10y
Ad

Answer this question