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: Broken loop and fail text.

Previous Thread :: Next Thread 
smunkey is not online. 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
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
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 is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
27 Jul 2014 05:41 PM
Countdown?
Report Abuse
smunkey is not online. 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 is not online. smunkey
Joined: 17 Dec 2011
Total Posts: 342
27 Jul 2014 06:41 PM
bump
Report Abuse
smunkey is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. smunkey
Joined: 17 Dec 2011
Total Posts: 342
27 Jul 2014 07:22 PM
Okay, I fixed it.
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