I have an audio on death script right here, and it used to work in the other games I had used it in.
id = "172294682"
t = 10
Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=172294682")
repeat wait() until game.Workspace:findFirstChild(script.Parent.Parent.Name)
sound = script.Sound
sound.SoundId = "http://www.roblox.com/asset/?id=172294682"
char = script.Parent.Parent.Character
print("TOO BAD")
char.Humanoid.Died:connect(function()
print("Died")
sound:Play()
wait(t)
Sound:Stop()
end)
I have been toying around with it, but no matter what I do, it doesn't seem to work. I have the sound file uploaded and everything else, but I just don't understand what can be causing the problem.
Try this (this might be what you have, but it should work). Make sure this is a LocalScript and it is in the StarterGui or Backpack.
local ContentProvider = game:GetService('ContentProvider') local Player = game.Players.LocalPlayer local Character = game.Workspace:WaitForChild(Player.Name) local Humanoid = Character:WaitForChild('Humanoid') local Sound = Instance.new('Sound', Player.PlayerGui) Sound.SoundId = "http://www.roblox.com/asset/?id=172294682" --Insert your sound Id here ContentProvider:Preload(Sound.SoundId) Humanoid.Died:connect(function() Sound:Play() --Sound will automatically stop playing when the player respawns end)