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

The music w'ont stop when player died !!! ??

Asked by 6 years ago
game.Players.PlayerAdded:Connect(function(plr)

     plr.CharacterAdded:connect(function(char)
        char:WaitForChild("Humanoid").Died:connect(function()
            print(plr.Name.." died!")
            if game.ReplicatedStorage.RandomMusic.Music1.Playing == true then
                game.ReplicatedStorage.RandomMusic.Music1:Stop()
            end
            if game.ReplicatedStorage.RandomMusic.Music2.Playing == true then
                game.ReplicatedStorage.RandomMusic.Music2:Stop()
            end
            if game.ReplicatedStorage.RandomMusic.Music3.Playing == true then
                game.ReplicatedStorage.RandomMusic.Music3:Stop()
            end
            if game.ReplicatedStorage.RandomMusic.Music4.Playing == true then
                game.ReplicatedStorage.RandomMusic.Music4:Stop()
            end
            if game.ReplicatedStorage.RandomMusic.Music5.Playing == true then
                game.ReplicatedStorage.RandomMusic.Music5:Stop()
            end
        end)
    end)
end)


0
Not sure what's wrong, but I suggest you use a for loop so you're not repeating yourself so much. ScrewDeath 153 — 6y
0
You do not stop the music when they spawn you only play the music when the die User#5423 17 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Use a local script like how I did with mine. Use this code and put in a sound in StarterGui, then insert a LocalScript. This is only if you die.If you reset, the music would start playing from the beginning.

local sound1= 884696085
local music=script.Parent
local sound2= 214902446
local music=script.Parent
local sound3= 225000651
local music=script.Parent
local sound4= 1088486530
local music=script.Parent
local sound5= 515864049
local music=script.Parent
local sound5= 515864049
local music=script.Parent
local sound6= 706817339
local music=script.Parent
local sound7= 515864049
local music=script.Parent

while true do
    wait()  
    music.SoundId="rbxassetid://"..sound1
    music:Play()
    music.Ended:Wait()
    wait()  
    music.SoundId="rbxassetid://"..sound2
    music:Play()
    music.Ended:Wait()
    wait()  
    music.SoundId="rbxassetid://"..sound3
    music:Play()
    music.Ended:Wait()
    wait()  
    music.SoundId="rbxassetid://"..sound4
    music:Play()
    music.Ended:Wait()
    wait()  
    music.SoundId="rbxassetid://"..sound5
    music:Play()
    music.Ended:Wait()
    wait()  
    music.SoundId="rbxassetid://"..sound6
    music:Play()
    music.Ended:Wait()
    wait()  
    music.SoundId="rbxassetid://"..sound7
    music:Play()
    music.Ended:Wait()
end
Ad

Answer this question