|
| 05 Jul 2012 04:20 AM |
The script is supposed to subtract from the value over time. I'm trying to make it so if it hits an object that upgrades the value back to 10, it will still work. Problem: It will only subtract to 9. Please fix! Thanks. Script:
if script.Parent.Value == 10 then wait(20) script.Parent.Value = 9 elseif script.Parent.Value == 9 then wait(20) script.Parent.Value = 8 elseif script.Parent.Value == 8 then wait(20) script.Parent.Value = 7 elseif script.Parent.Value == 7 then wait(20) script.Parent.Value = 6 elseif script.Parent.Value == 6 then wait(20) script.Parent.Value = 5 elseif script.Parent.Value == 5 then wait(20) script.Parent.Value = 4 elseif script.Parent.Value == 4 then wait(20) script.Parent.Value = 3 elseif script.Parent.Value == 3 then wait(20) script.Parent.Value = 2 elseif script.Parent.Value == 2 then wait(20) script.Parent.Value = 1 elseif script.Parent.Value == 1 then wait(20) script.Parent.Value = 0 end |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 05 Jul 2012 05:57 AM |
function Touch(hit)
if script.Parent.Value <= 10 and script.Parent.Value > 0 then script.Parent.Value = script.Parent.Value -1 end
script.Parent.Touched:connect(Touch)
Do you mean like that? |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2012 02:16 PM |
@Cheater Something like that... Thanks! |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2012 02:28 PM |
You would have to end the function, Cheater.
> † KMXD † |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Jul 2012 02:44 PM |
This script works, except if you fill it up back to 10 when it's 1, it will go to zero instead of re starting the process. Can you fix it? Thanks. Here's the other script:
script.Parent.Value = 10 wait(20) script.Parent.Value = 9 wait(20) script.Parent.Value = 8 wait(20) script.Parent.Value = 7 wait(20) script.Parent.Value = 6 wait(20) script.Parent.Value = 5 wait(20) script.Parent.Value = 4 wait(20) script.Parent.Value = 3 wait(20) script.Parent.Value = 2 wait(20) script.Parent.Value = 1 wait(20) script.Parent.Value = 0
|
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 05 Jul 2012 02:50 PM |
| Cheater's works, just add the end. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2012 02:54 PM |
@White Where? It has an end in it, and it does not work. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2012 02:55 PM |
| He mean't add an "extra" end. One end is not enough. Two should do the trick. |
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 05 Jul 2012 02:57 PM |
| Yes. that end was for the if..then statement. You need another end for the actual function. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2012 02:58 PM |
nuu use my script in ur otter thread
> † KMXD † |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2012 03:02 PM |
while true do for i = 1, 11 do script.Parent.Value = 11-i wait(10) end end |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2012 03:07 PM |
while wait(20) do if script.Parent.Value > 0 then script.Parent.Value = script.Parent.Value - 1 else script.Parent.Value = 10 end end
> † KMXD † |
|
|
| Report Abuse |
|
|