|
| 17 Jan 2015 05:00 AM |
local Player = game.Players.LocalPlayer local SoundPack = script:GetChildren()
Player.CharacterAdded:connect(function(Character) local Humanoid = Character.Humanoid Humanoid.Died:connect(function() local RandomSound = SoundPack[math.random(1, 26)] RandomSound.Parent = Player RandomSound:Play() end) end)
it's inside a gui local scrip obv |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 05:48 AM |
im really not sure where your error is whats the output? unless you load all the sounds after the script is put in existance then idk lol try v
game.Players.LocalPlayer.CharacterAdded:connect(function(Character) local Humanoid = Character.Humanoid Humanoid.Died:connect(function() local SoundPack = script:GetChildren() local RandomSound = SoundPack[math.random(1, #SoundPack)] -- im assuming 26 is all the sounds RandomSound.Parent = Player RandomSound:Play() end) end)
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 05:52 AM |
probably should've gotten rid of soundpack entirely local RandomSound = script:GetChildren()[math.random(1, #script:GetChildren())] hehe
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 06:24 AM |
>[math.random(1, #script:GetChildren())]
wrong!! |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 06:26 AM |
theres an extra ) at :GetChildren(), remove it 4 fix :>
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
parkiet3
|
  |
| Joined: 16 Jul 2011 |
| Total Posts: 832 |
|
|
| 17 Jan 2015 06:27 AM |
| Add a print, im not sure if it runs the characteradded, cuz i think the character loads faster than guis |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 06:29 AM |
like this?
game.Players.LocalPlayer.CharacterAdded:connect(function(Character) local Humanoid = Character.Humanoid Humanoid.Died:connect(function() local RandomSound = script:GetChildren()[math.random(1, 25)script:GetChildren()] RandomSound.Parent = Player RandomSound:Play() end) end) |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 06:32 AM |
oh, i tried to fix something that wasnt inherently broken but when you open out output does it have a specific error to it? possible errors onthe randomsound line include script:GetChildren() being nil that's it :>
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 06:34 AM |
ocal RandomSound = script:GetChildren()[math.random(1, 25)script:GetChildren()]
>math.random(1, 25)script:
its bad
|
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 06:38 AM |
it should still be this: game.Players.LocalPlayer.CharacterAdded:connect(function(Character) local Humanoid = Character.Humanoid Humanoid.Died:connect(function() local SoundPack = script:GetChildren() local RandomSound = SoundPack[math.random(1, #SoundPack)] -- im assuming 26 is all the sounds RandomSound.Parent = Player RandomSound:Play() end) end) if its bad then it'll say something in the output.
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 06:39 AM |
game.Players.LocalPlayer.CharacterAdded:connect(function(Character) local Humanoid = Character.Humanoid Humanoid.Died:connect(function() local RandomSound = script:GetChildren()[math.random(1, #script:GetChildren())] -- im assuming 26 is all the sounds RandomSound.Parent = Player RandomSound:Play() end) end)
misdid it AGAIN hnneueuugh
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
| |
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 06:42 AM |
game.Players.LocalPlayer.CharacterAdded:connect(function(Character) local Humanoid = Character.Humanoid Humanoid.Died:connect(function() local RandomSound = script:GetChildren()[math.random(1, #script:GetChildren())] -- im assuming 26 is all the sounds RandomSound.Parent = game.Players.LocalPlayer RandomSound:Play() end) end)
should work
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 06:45 AM |
game.Players.LocalPlayer.CharacterAdded:connect(function(Character) local Humanoid = Character.Humanoid Humanoid.Died:connect(function() if game.Players.LocalPlayer:findFirstChild("Sound") then game.Players.LocalPlayer:findFirstChild("Sound"):remove() end local RandomSound = script:GetChildren()[math.random(1, #script:GetChildren())] RandomSound.Parent = game.Players.LocalPlayer RandomSound:Play() end) end)
thisll make it so the sounds cant overlap also are these meant to be death sounds or just changing music when you die, there is le difference.
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 06:51 AM |
death sounds
also only works in studio
df |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 06:54 AM |
try this game.Players.LocalPlayer.CharacterAdded:connect(function(Character) local Humanoid = Character:WaitForChild("Humanoid") Humanoid.Died:connect(function() local RandomSound = script:GetChildren()[math.random(1, #script:GetChildren())] RandomSound.Parent = Character RandomSound:Play() end) end)
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 06:56 AM |
OGM
it finally works ily
also could u do that it stops on respawn |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 17 Jan 2015 07:08 AM |
game.Players.LocalPlayer.CharacterAdded:connect(function(Character) local Humanoid = Character:WaitForChild("Humanoid") Humanoid.Died:connect(function() local RandomSound = script:GetChildren()[math.random(1, #script:GetChildren())] RandomSound.Parent = Character RandomSound.Played:connect(function() local RSV = RandomSound.Volume for i=1,50 do RandomSound.Volume = RSV - i * (RSV/50) wait(0.1) end end) RandomSound:Play() end) end)
AND THE TIGER GOES ROAR |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Jan 2015 09:04 AM |
| everyone in the server hears the sound though :( |
|
|
| Report Abuse |
|
|