smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 27 Jul 2014 05:39 PM |
I have this localscript inside of a textlabel that will make the textlabel constantly show the value of '_G.lpc'(which starts as 50).
if _G.lpc>1 then repeat until _G.lpc<=1 script.Parent.Text = _G.lpc wait = 1 end
At line one it says that I can't compare numbers to a nil value in the output. AT first I tried moving the '_G.lpc = 50' line of code into this script, but I was greeted with a crashed studio when I tried to run it. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2014 05:41 PM |
Spawn(wait);if _G.lpc>1 then repeat until _G.lpc<=1 script.Parent.Text = _G.lpc wait = 1 end |
|
|
| Report Abuse |
|
|
UncleTaz
|
  |
| Joined: 19 Aug 2009 |
| Total Posts: 12795 |
|
| |
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 27 Jul 2014 05:45 PM |
It just crashed faster with that script :l
It's not really countdown, it's sort of like an inventory that tells you how much of something you have. |
|
|
| Report Abuse |
|
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
| |
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 27 Jul 2014 07:08 PM |
After some testing I got the script to this
while _G.lpc > 1 do script.parent.text =_G.lpc wait = .3 end
However it says that I am trying to compare a number to a nil value in the first line, which is weird since there are no nils to my knowledge. |
|
|
| Report Abuse |
|
|
ehern11
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1541 |
|
|
| 27 Jul 2014 07:10 PM |
| smun, spawn(wait) makes it crash and that's all he added to your script |
|
|
| Report Abuse |
|
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 27 Jul 2014 07:12 PM |
| I know, but I got it to the above script and now it says that _G.lpc (50) is nil, 50 is a lot more than zero |
|
|
| Report Abuse |
|
|
fret13103
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 881 |
|
|
| 27 Jul 2014 07:12 PM |
while _G.lpc>1 do script.Parent.Text = _G.lpc wait(1) end |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 27 Jul 2014 07:13 PM |
if _G.lpc>1 then repeat until _G.lpc<=1
That will crash because its running infinite code instantly It won't have time for _G.lpc to ever change |
|
|
| Report Abuse |
|
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 27 Jul 2014 07:13 PM |
| 128gb, i fixed that with the above script... like i said, now it is saying that 50 is a nil value |
|
|
| Report Abuse |
|
|
fret13103
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 881 |
|
|
| 27 Jul 2014 07:14 PM |
First problem, wait is written like this
wait(NUMBER)
Second, you need to initiate _G.lpc
you can't just call it without saying what it is.
local _G.lpc = 50
while _G.lpc>1 do script.Parent.Text = _G.lpc wait(1) _G.lpc-1 end |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 27 Jul 2014 07:14 PM |
'while _G.lpc > 1 do script.parent.text =_G.lpc wait = .3 end'
There are no waits in this script |
|
|
| Report Abuse |
|
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
|
| 27 Jul 2014 07:16 PM |
| _G.lpc is a global variable, however i didn't know you had to do that with the wait value. |
|
|
| Report Abuse |
|
|
smunkey
|
  |
| Joined: 17 Dec 2011 |
| Total Posts: 342 |
|
| |
|