generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Died Event Help

Previous Thread :: Next Thread 
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 02:39 PM
Hi, I'm trying to make a certain sound stop when a player dies. I don't know what I did wrong so if anyone could correct me that'd be awesome. Thanks.

function died()
game.Workspace.Chase:Stop()
end
game.Players:Died()
Report Abuse
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
25 Feb 2014 02:44 PM
function stopSound()
workspace.Chase:stop()
end


function getPlayer()
for _, plr in pairs (game.Players:GetChildren()) do
repeat wait() until plr.Character
plr.Character.Humanoid.Died:connect(stopSound)
end
end


game.Players.PlayerAdded:connect(getPlayer)
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 02:45 PM
Thanks, I'll have to see if it works later.
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 03:24 PM
Aww, it's not working. :(
Report Abuse
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
25 Feb 2014 04:20 PM
y u no post the output?!?!
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
25 Feb 2014 04:27 PM




function plrDied(plr)
print(plr.Name.. " kicked the bucket.")
Workspace["Sound"]:Stop()
end

game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.Character
plr.Character:WaitForChild("Humanoid").Died:connect(function() plrDied(plr) end)
plr.CharacterAdded:connect(function(c) c:WaitForChild("Humanoid").Died:connect(function() plrDied(plr) end)
end)
end)
Report Abuse
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
25 Feb 2014 04:29 PM
azrath... i think we have the same thing!!!! *rips hair
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
25 Feb 2014 04:30 PM
Yours only fires for the first death.
Report Abuse
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
25 Feb 2014 04:32 PM
oh yes, yes it is
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 05:12 PM
Thanks, guys, but it still isn't working. It did print "Player 1 has kicked the bucket", however the music didn't stop.
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 05:19 PM
I never thought it'd be this hard to use an event.
I've tried to make the beginning of the script however it won't work
game.Players:Died(function)players)
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
25 Feb 2014 05:25 PM
Put this in workspace as a normal script, test it in start server/player mode:

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
game.Workspace.Chase:Stop()
end)
end)
end)

When life gives you lemons... BURN HIS HOUSE DOWN! >:D
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 05:29 PM
It didn't work, but here's the output: "WaitForChild called on an Instance that is not in a DataModel."
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 05:36 PM
b1
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 05:40 PM
b2
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 05:58 PM
b3
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image