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 » Scripters
Home Search
 

Re: Player Reset / Leave

Previous Thread :: Next Thread 
jbn011 is not online. 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 is not online. 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
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
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 is not online. 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
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
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 is not online. 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
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
10 Oct 2016 04:45 PM
if game.Players:FindFirstChild('PlayerName') then
Report Abuse
Soybeen is not online. 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
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
10 Oct 2016 05:07 PM
Don't you dare criticise apostrophes, they're the best punctuation.
Report Abuse
Soybeen is not online. 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
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
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 is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
10 Oct 2016 05:15 PM
@soy only skids do that ugly way


Report Abuse
Soybeen is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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