jbn011
|
  |
| Joined: 30 Aug 2010 |
| Total Posts: 479 |
|
|
| 10 Oct 2016 02:57 PM |
What would be the best way to detect if a player resets/leaves?
I'm trying to make something where if they reset, a remoteEvent is fired. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 10 Oct 2016 02:59 PM |
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(char) hum = char:WaitForChild("Humanoid") hum.Died:connect(function() -- do your thing when they die end) end) end)
game.PlayerRemoving:connect(function(player) -- do your thing if they leave end) |
|
|
| Report Abuse |
|
|
|
| 10 Oct 2016 03:00 PM |
player.CharacterAdded fires when they spawn in. player.CharacterRemoved fires when they die/leave. humanoid.Died fires when they go to 0 health. |
|
|
| Report Abuse |
|
|
jbn011
|
  |
| Joined: 30 Aug 2010 |
| Total Posts: 479 |
|
|
| 10 Oct 2016 03:14 PM |
| @cheesecake - How do you apply that? Is it a event of Players? |
|
|
| Report Abuse |
|
|
|
| 10 Oct 2016 03:33 PM |
CharacterAdded and CharacterRemoving are an event of Player:
game.Players.PlayerAdded:connect(function(plyr) plyr.CharacterAdded:connect(function() ---- end) plyr.CharacterRemoving:connect(function() ---- end) end) Died is an event of Humanoid:
plyr.CharacterAdded:connect(function(char) char.Humanoid.Died:connect(function() ---- end) end) |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Oct 2016 03:39 PM |
How to scan if a player is still in the game?
|
|
|
| Report Abuse |
|
|
|
| 10 Oct 2016 04:45 PM |
| if game.Players:FindFirstChild('PlayerName') then |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 10 Oct 2016 05:00 PM |
Semantically if you're gonna use apostrophes instead of quotes you may as well do without the parenthesis to save some keystrokes ;)
if game.Players:FindFirstChild'Soybeen' then |
|
|
| Report Abuse |
|
|
|
| 10 Oct 2016 05:07 PM |
| Don't you dare criticise apostrophes, they're the best punctuation. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 10 Oct 2016 05:13 PM |
What if you want to use a contraction in a string? 'this isn't gonna work!' :( |
|
|
| Report Abuse |
|
|
|
| 10 Oct 2016 05:14 PM |
In that case I have to succumb to the quotation marks.... unfortunately I can't do: 'this isn\'t gonna work!' |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 10 Oct 2016 05:15 PM |
@soy only skids do that ugly way
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 10 Oct 2016 05:24 PM |
Skids who want to save keystrokes and DevVince, he encouraged me to switch from ("") to ' ' when possible, and he's probably not regarded as a skid. o.O |
|
|
| Report Abuse |
|
|