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: Is it me or ROBLOX?

Previous Thread :: Next Thread 
ShadowAley is not online. ShadowAley
Joined: 23 Jun 2010
Total Posts: 4823
29 May 2015 09:22 PM
- Tag is not a valid member of Player

What??

function checkplayers()
for _,v in pairs(game.Players:GetPlayers()) do
if v.Tag then
playersdead = false
else
playersdead = true
end
end
end





If the tag doesn't exist then why doesn't it just keep the value at false instead of printing an error?
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
29 May 2015 09:24 PM
if v:FindFirstChild("Tag") then
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
29 May 2015 09:25 PM
You are trying to index Tag and when it is not there it errors.

http://wiki.roblox.com/index.php?title=FindFirstChild


I script -~ chimmihc
Report Abuse
ShadowAley is not online. ShadowAley
Joined: 23 Jun 2010
Total Posts: 4823
29 May 2015 09:27 PM
Thank you. Is FindFirstChild used for that? I thought it was just a fancy way of saying v.Tag
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
29 May 2015 09:35 PM
No, FindFirstChild IS used for that EXACT purpose.
You don't even need FindFirstChild to find things with spaces in the name; you can do Parent["Child With Spaces"]

Roblox was really dumb to not add support for returning nil.
Instances and Vector3s and stuff like that are Userdata. Userdata need to have functions set up for them defined by who makes it. Roblox just didn't add support for returning nil, which was WAY stupid.
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
29 May 2015 09:38 PM
> Roblox was really dumb to not add support for returning nil.

What exactly do you mean by "add support for returning nil"?
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
29 May 2015 09:39 PM
>What exactly do you mean by "add support for returning nil"?

I believe he's referring to the way the script errors when you reference a non-existent object, instead of simply returning as nil.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
29 May 2015 09:41 PM
Yes. Because now you can't do "if workspace.Something then", and it confuses a LOT of people.
And "What exactly do you mean by 'Add support for returning nil'?" is somewhat obvious, as I explained what I meant in the post that I said it. Roblox didn't add support for it when they made the userdata.
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
29 May 2015 09:48 PM
We should make a wrapper that fixes that!
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
29 May 2015 09:52 PM
The way it was worded made it sound at first like "support for how to handle an already returned nil". Sorry about that.
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
29 May 2015 09:55 PM
It was and is intentional because in many cases it makes more sense for it to error rather than just return a nil value.
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