|
| 23 Jun 2015 05:01 PM |
For some reason I get this output,
Output:
attempt to compare nil with a number
This is the line
if Player.PlayerGui:FindFirstChild("GameHUD").Points.Points.Value > highscore then
Yes, highscore is a variable for a number. highscore = 0. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 23 Jun 2015 05:02 PM |
| .Points.Points? Are you sure that's right? |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2015 05:05 PM |
print(Player.PlayerGui:FindFirstChild("GameHUD").Points.Points.Value, highscore) if Player.PlayerGui:FindFirstChild("GameHUD").Points.Points.Value > highscore then
|
|
|
| Report Abuse |
|
|
|
| 23 Jun 2015 05:13 PM |
| Yes, points.points is right. Points is the name of a textlabel, and the second points is an intvalue. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2015 05:15 PM |
| Also, it works sometimes. Sometimes it works, sometimes it doesn't. |
|
|
| Report Abuse |
|
|
| |
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 23 Jun 2015 05:36 PM |
Either points.Value is nil or highscore is nil. Points.Value should under no circumstances be nil.
if (highscore == nil) or (Player.PlayerGui:FindFirstChild("GameHUD").Points.Points.Value > highscore) then
Comparing highscore to nil is far more readable and far more reasonable than using "not" where it doesn't belong. |
|
|
| Report Abuse |
|
|