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

How would i make a audio play upon death?

So heres what i tried [I'm not very good at scripting] Trial #1 game.workspace.Players.LocalPlayer if health = 0 then wait (0.1) game.workspace.Audio1.play

Trial #2 game.workspace.Players.LocalPlayer Health=H If H = 0 then wait(0.1) game.workspace.Audio1.sound

2 answers

✓ Accepted answer
game:GetService('Players').PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(plr2)
        plr2:WaitForChild("Humanoid").Died:connect(function()
            game.Workspace.YourAudio:play()
        end)
    end)
end)

That should work. It just checks if the Humanoid has died and if it does it plays the music.

Nice attempt. I just grabbed this script from the Wiki's page on the Died event

game:GetService('Players').PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		character:WaitForChild("Humanoid").Died:connect(function()
			game.Workspace.Audio1:Play()
		end)
	end)
end)

1 comment

0

I tried both of the answers neither of them worked. I placed the audio in workspace and then replaced Audio1 and Your Audio With the audio's name. It didn't work.

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