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
 

Can someone please fix this?

Previous Thread :: Next Thread 
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
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 is not online. 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
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
05 Jul 2012 02:16 PM
@Cheater
Something like that... Thanks!
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
05 Jul 2012 02:28 PM
You would have to end the function, Cheater.

> † KMXD †
Report Abuse
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
05 Jul 2012 02:40 PM
It still no work.
Report Abuse
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
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 is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
05 Jul 2012 02:50 PM
Cheater's works, just add the end.
Report Abuse
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
05 Jul 2012 02:54 PM
@White
Where? It has an end in it, and it does not work.
Report Abuse
Swordphin123 is not online. Swordphin123
Joined: 09 Apr 2008
Total Posts: 5234
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 is not online. 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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
05 Jul 2012 02:58 PM
nuu use my script in ur otter thread

> † KMXD †
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
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