|
| 22 Jan 2014 09:10 PM |
I've tried using both CharacterRemoving and Humanoid.Died, but neither are working. Is that what I should be using, or is there a better way to call a function upon a player's death?
|
|
|
| Report Abuse |
|
|
| |
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 22 Jan 2014 09:43 PM |
| The event is indded humanoidhere.Died, and does work. What are ya trying to do? |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2014 09:49 PM |
I was just testing out to see if it worked.
game.Players.PlayerAdded:connect(function(player) player.Character.Humanoid.Died:connect(function(humanoid) print(player.Character.Name.." has died!") end) end)
|
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 22 Jan 2014 09:50 PM |
| That should work fine... j use this event for leaderstats. |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2014 09:57 PM |
It doesn't work, that's my problem. And I will be needing to use this event later, I usually test out the event a few times to make sure I know how to use it the right way before I use it in a real script.
|
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 22 Jan 2014 10:00 PM |
Maybe do in a localscript in startergui
plr = game:GetService("Players").LocalPlayer hum = plr.Character["Humanoid"]
hum.Died:connect(function() m = Instance.new("Message",workspace) m.Text = (plr.name.."has died") wait(1.5) m:remove() end)
|
|
|
| Report Abuse |
|
|
Ekkoh
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 524 |
|
|
| 22 Jan 2014 10:00 PM |
Did it happen to work once? The problem is you only connected it once. You need to reconnect the Died event of the Humanoid every time the character respawns.
Game:GetService("Players").PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) char:WaitForChild("Humanoid").Died:connect(function() print(plr.Name .. " has died.") end) end) end)
"We can walk a million miles, and end up in the sea." - George Ragan aka Johnny 3 Tears |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2014 10:00 PM |
| PlayerAdded does not fire in test/solo mode. |
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 22 Jan 2014 10:01 PM |
| @wak aye that is true as well. |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2014 10:05 PM |
Hm, your script is working. I guess I've been doing something wrong. Thanks!
|
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
| |
|
Ekkoh
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 524 |
|
|
| 22 Jan 2014 10:05 PM |
I believe ChildAdded does though. I'd just change it back to PlayerAdded when you're going to publish it.
"We can walk a million miles, and end up in the sea." - George Ragan aka Johnny 3 Tears |
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 22 Jan 2014 10:06 PM |
| Instead of printing i use messages to test in an online server. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 22 Jan 2014 10:08 PM |
game.Players.PlayerAdded:connect(function(player) player.Character.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function() print(player.Character.Name.." has died!") end) end) end) |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2014 10:08 PM |
Wak, PlayerAdded does fire in test/solo mode.
|
|
|
| Report Abuse |
|
|
|
| 22 Jan 2014 10:08 PM |
What I do to test playeradded scripts in solo
Change the player variable to script.Parent.Parent Put the script in starterpack
Test the game in solo. If it works, then change it back to whatever it was then leave it. |
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 22 Jan 2014 10:08 PM |
| @cnt he already used mine and it worked. Although, your would probably work too. |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Jan 2014 10:09 PM |
| http://wiki.roblox.com/index.php/PlayerAdded_(Event) |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2014 10:16 PM |
I use PlayerAdded in solo mode.... o3o
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 22 Jan 2014 10:16 PM |
| It sometimes works, depending on how slow your player loads |
|
|
| Report Abuse |
|
|