smunkeyJoin Date: 2011-12-17 Post Count: 342 |
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. |
|
|
Spawn(wait);if _G.lpc>1 then repeat until _G.lpc<=1
script.Parent.Text = _G.lpc
wait = 1
end |
|
UncleTazJoin Date: 2009-08-19 Post Count: 12795 |
Countdown? |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
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. |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
bump |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
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. |
|
ehern11Join Date: 2011-04-23 Post Count: 1541 |
smun, spawn(wait) makes it crash and that's all he added to your script |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
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 |
|
fret13103Join Date: 2010-03-15 Post Count: 881 |
while _G.lpc>1 do
script.Parent.Text = _G.lpc
wait(1)
end |
|
128GBJoin Date: 2014-04-17 Post Count: 8056 |
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 |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
128gb, i fixed that with the above script... like i said, now it is saying that 50 is a nil value |
|
fret13103Join Date: 2010-03-15 Post Count: 881 |
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 |
|
128GBJoin Date: 2014-04-17 Post Count: 8056 |
'while _G.lpc > 1
do
script.parent.text =_G.lpc
wait = .3
end'
There are no waits in this script |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
_G.lpc is a global variable, however i didn't know you had to do that with the wait value. |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
Okay, I fixed it. |
|