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
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
| |
|
| |
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
| |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
| |
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
| |
|
|
| 11 Mar 2013 08:19 PM |
| wait what? why are you trying to set a string value to 0? |
|
|
| Report Abuse |
|
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 11 Mar 2013 08:21 PM |
| Yea....(i'm doing something wrong .... .-.) |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2013 08:22 PM |
| a string value can only hold well strings... |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 11 Mar 2013 08:27 PM |
| Use an IntValue(IntegerValue) or a NumberValue |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 11 Mar 2013 08:36 PM |
| the script i gave you will keep it at 0 forever once it hits 0 |
|
|
| Report Abuse |
|
|
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 |
|
|