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: if then

Previous Thread :: Next Thread 
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 06:51 PM
while true do

wait(.5)

if script.Parent.Popu.Value <= 0 then

script.Parent.Popu.Value = 0

wait()

end
end

If Popu's Values equals 0 or lower then it stays 0 forever.
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 06:52 PM
No output.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
11 Mar 2013 06:52 PM
okay?
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 06:53 PM
Why is it not working?
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
11 Mar 2013 06:54 PM
remove while true do
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
11 Mar 2013 06:54 PM
local bob = false;
script.Parent.Popu.Changed:connect(function()
if script.Parent.Popu.Value <= 0 then
bob = true;
end;
if bob then
script.Parent.Popu.Value = 0;
end;
end)
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 07:02 PM
I placed a while true do so that the value always stays at 0 no matter what(i have another script decreasing the value of Popu.)
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 07:29 PM
Sc:3: attempt to compare string with number

notso thats the output of your script.
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 07:49 PM
bump
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 07:57 PM
bump bump
Report Abuse
veerstrong is not online. veerstrong
Joined: 23 Jun 2009
Total Posts: 2450
11 Mar 2013 08:03 PM
Is this a GUI Button?

~One must risk everything to find the truth. Even if the truth isn't what you want it to be, it is better than living a lie.~
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 08:04 PM
No it is a TextLabel, well the script is located in a textlabel.
Report Abuse
veerstrong is not online. veerstrong
Joined: 23 Jun 2009
Total Posts: 2450
11 Mar 2013 08:14 PM
The value of popo
What type of value is it?


~One must risk everything to find the truth. Even if the truth isn't what you want it to be, it is better than living a lie.~
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 08:16 PM
String value
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
11 Mar 2013 08:19 PM
wait what? why are you trying to set a string value to 0?
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 08:21 PM
Yea....(i'm doing something wrong .... .-.)
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
11 Mar 2013 08:22 PM
a string value can only hold well strings...
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 08:23 PM
so what type of value do i need to use that still uses numbers?
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
11 Mar 2013 08:24 PM
local bob = false;
script.Parent.Popu.Changed:connect(function()
if tonumber(script.Parent.Popu.Value) <= 0 then
bob = true;
end;
if bob then
script.Parent.Popu.Value = 0;
end;
end)
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 08:27 PM
Can someone explain what tonumbers do and what recursions do and how are they useful?
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
11 Mar 2013 08:27 PM
Use an IntValue(IntegerValue) or a NumberValue
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 08:29 PM
Wait if i have a script decreasing the value of Popu(if any of you are wondering Popu is short for Population...) will this script you guys gave me maintain the zero and not decrease?
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
11 Mar 2013 08:35 PM
tonumber just changed a string into a number...

recursion is just a function that calls itself...
ex:

Bob = function()
print"This is an infanite loop"
wait()
Bob()
end

or in a more us full example

Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
11 Mar 2013 08:36 PM
the script i gave you will keep it at 0 forever once it hits 0
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
11 Mar 2013 08:38 PM
Thanks i will make sure to acknowledge all of you that have helped in the past months(In my game....)
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