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: Better onRespawn event?

Previous Thread :: Next Thread 
socccerstar is not online. socccerstar
Joined: 23 Aug 2008
Total Posts: 489
11 Feb 2012 04:21 PM
I'm writing the script for a leaderboard, and I need to know which is a better method for an onPlayerRespawn function:


player.Changed:connect(...)

or

onPlayerRespawned(...)
player.CharacterAdded:connect(...)
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
11 Feb 2012 04:21 PM
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)

end) end)
Report Abuse
socccerstar is not online. socccerstar
Joined: 23 Aug 2008
Total Posts: 489
11 Feb 2012 04:23 PM
So...I take from your lack of answering my question the best way would be to initiate a CharacterAdded event at the start of the PlayerAdded event?
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
11 Feb 2012 04:54 PM
CharacterAdded is the best way.
Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
11 Feb 2012 04:58 PM
You could use,
Player.Changed:connect(function(Character)
if Player.Character~=nil then
--respawn
else
--death
end
end)
Report Abuse
Phellem is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
11 Feb 2012 04:59 PM
I prefer CharacterAdded.
.Changed is fired when the 'properties' changed.
You don't want it to fire when the Player's property such as "TeamColor", "AccountAge",ect.
Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
11 Feb 2012 05:03 PM
@Phellem,
You should do a research about it before you post,
this is an example which only fires when the Value property is changed;
Instance.new('ObjectValue',workspace).Changed:connect(function(Value)
Print 'the value property is changed'
end)
Report Abuse
Phellem is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
11 Feb 2012 05:14 PM
http://wiki.roblox.com/index.php/Changed

game.Players.Phellem.Changed:connect(function(change)
print("Player's " ..change..' has been changed')
end)

Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
11 Feb 2012 05:19 PM
@Phellem
That doesn't prove anything, my script works.
Try it before you post again.
Report Abuse
Phellem is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
11 Feb 2012 05:27 PM
"I prefer CharacterAdded.
.Changed is fired when the 'properties' changed.
You don't want it to fire when the Player's property such as "TeamColor", "AccountAge",ect. [changed]"

Then I proved to you that when an object's property changed, it fired.
Also, I know your code works.



"You should do a research about it before you post,
this is an example which only fires when the Value property is changed"

I did do research before posting. I don't know why you're so exasperated.
Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
11 Feb 2012 05:30 PM
While using a valid property of the object as an argument it only effects when the certain property is changed.
Report Abuse
Phellem is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
11 Feb 2012 05:38 PM
Your point was?

My first statement I've posted was correct.
Report Abuse
socccerstar is not online. socccerstar
Joined: 23 Aug 2008
Total Posts: 489
11 Feb 2012 05:42 PM
I see this is a much-disputed subject.
Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
11 Feb 2012 05:44 PM
@Phellem,
You should understand my point from that,
I'm not going to explain it again.
Report Abuse
socccerstar is not online. socccerstar
Joined: 23 Aug 2008
Total Posts: 489
11 Feb 2012 05:50 PM
Scripts execute procedurally:

object.Changed:connect(

The computer reads this and when 'object' is changed in anyway, it goes to the next part:

function(property)

This the function the event calls when 'object' is changed. 'property' IS NOT SPECIFIED HERE. This is the key that contains the property that is changed, which is passed by the event.

if property == "Character" then

This tells us if the property is what we want, if so, go on, if not, skip this.

end
end)

This is self-explanatory

So, in conclusion, .Changed is called whenever a property is changed, no matter what property it is. I don't remember whose side this is for though...
Report Abuse
socccerstar is not online. socccerstar
Joined: 23 Aug 2008
Total Posts: 489
11 Feb 2012 05:51 PM
I think I just answered my own question...
Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
11 Feb 2012 06:00 PM
@soc,
You're not reading my posts..

Lrn2scrpt
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