I tried the died event with an audio player script under it, but it is not working.~~~~~~~~~~~~~~~~~ game:GetService('Players').PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function() print(player.Name .. " has died!") local s = Instance.new("Sound")
s.Name = "Sound" s.SoundId = "143796003" s.Volume = 3 s.Looped = false s.archivable = false
s.Parent = game.Workspace
wait(0)
s:play()
end end ~~~~~~~~~~~~~~~~~
Your script didn't work for 2 reasons, reason 1 would be that you did not have the url for the sound you just had numbers. Number two would be you need three ends at the end of the script with three of these braces )
1.the url should be http://www.roblox.com/asset/?id=143796003 2. end) end) end) --here is the script fixed game:GetService('Players').PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function() print(player.Name .. " has died!") local s = Instance.new("Sound") s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=143796003" s.Volume = 3 s.Looped = false s.archivable = false s.Parent = game.Workspace wait(0) s:play() end) end) end)
I'll give you an idea Intructions:
1. Create a LocalScript and a Script into ScreenGui 2. Put this inside both of the scripts:
while true do wait(0.5) if script.Parent.Parent.Character.Humanoid.Health <= 0 then local s = Instance.new("Sound", game.Workspace) s.SoundId = "rbxassetid://143796003" s.Volume = 3 s.Looped = false wait() s:Play() wait(5)-- put time amount to remove s:remove() end end
ALSO YOUR SOUND ID SHOULD BE "rbxassetid://143796003"
s.SoundId = "http://www.roblox.com/asset/?id=143796003"