|
| 05 Apr 2014 12:13 AM |
while true do wait(5) local Value1 = script.Parent local CT = script.Parent.Parent.CT CT.Value = CT.Value -Value1.Value end |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:16 AM |
local Value1 = script.Parent local CT = script.Parent.Parent.CT
while true do wait(5) CT.Value = CT.Value -Value1.Value end
I think it was because you were defining the variables inside the loop.
Also, if it's a local script, add a wait(1) at the top. Like this:
wait(1)
local Value1 = script.Parent local CT = script.Parent.Parent.CT
while true do wait(5) CT.Value = CT.Value -Value1.Value end |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Apr 2014 12:20 AM |
| What exactly are you trying to do? |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:20 AM |
| So if the value of Value1 is 5, then every 5 second it will subtract 5 from the value of CT. Understand that? Its hard to explain |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Apr 2014 12:31 AM |
um local variable with parent? lolno |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:32 AM |
while true do wait(5) Value1 = script.Parent CT = script.Parent.Parent.CT CT.Value = CT.Value -Value1.Value end -- local vars accessed from anywhere, can't use parents of script. |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:35 AM |
Lets say the value of Value1 is 15, and the value of CT is 400. Every 5 second, it should do 400 - 15. Now lets say the Value of 1 changes to 10, now, every 5 second it should do 400 - 10. Thats why a script like this:
while true do wait(5) local Value1 = script.Parent local CT = script.Parent.Parent.CT CT.Value = CT.Value -10 end
wouldn't work. Because it would continuously do 10, not the value of value1...
Does that explain it better? |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:36 AM |
Did you try what I said? Additionally, going further in depth about the values is appreciated. |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:37 AM |
| First of all, I don't see a change. Second, no it doesn't work. Should I run it in a local script? |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:41 AM |
| Should I run it in a local script? *Cough wow Cough* |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:42 AM |
| Hold on, are these StringValues or IntValues? To apply math operations, it must be an IntValue. |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Apr 2014 12:43 AM |
| Can you please stop posting on other scripts asking why we won't help you but we'll help them? I really don't know what's wrong with your script, but I'm sure someone will find out without you spamming. :\ |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:44 AM |
| Wait! I put IntValue, but it says their string! Let me fix that... |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:45 AM |
| The change I made is strictly within grammatical references of scripting. You improperly used a local variable there. If Value1's value is not changing, why not increment it in a forloop rather then doing this? |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 12:45 AM |
| I'm so sorry! This was all my fault! I forgot to change the value of #1 to 5 so it started subtracting, and I needed int values. I am so sorry D: |
|
|
| Report Abuse |
|
|