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: Looking for some help;

Previous Thread :: Next Thread 
TheShoeBox is not online. TheShoeBox
Joined: 20 Aug 2010
Total Posts: 5022
28 Jan 2012 10:00 PM
So I made a script where you click a brick, and the value of something goes up by one evrey ten seconds. You click it again, it goes down. This is the part that makes it go up.

while true do
script.Parent.val.Value = script.Parent.val.Value + 1
wait(10)
end

Every time it goes up, it immediately goes back to 0. What's wrong?

Any help would be nice. Thanks.
Report Abuse
Presentable is not online. Presentable
Joined: 10 Jul 2011
Total Posts: 735
28 Jan 2012 10:01 PM
You lost me at "I made a script"
Report Abuse
TheShoeBox is not online. TheShoeBox
Joined: 20 Aug 2010
Total Posts: 5022
28 Jan 2012 10:02 PM
Please only post if you're going to help.
Here's the entire script if you want.

x = script.Parent.Parent.GenColor

function onClicked()

if x.BrickColor == BrickColor.new("Lime green") then
x.BrickColor = BrickColor.new("Really red")
while true do
script.Parent.val.Value = script.Parent.val.Value - 1
wait(10)
end

elseif x.BrickColor == BrickColor.new("Really red") then
x.BrickColor = BrickColor.new("Lime green")
while true do
script.Parent.val.Value = script.Parent.val.Value + 1
wait(10)
end
end
end


script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
28 Jan 2012 10:04 PM
[ Content Deleted ]
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
28 Jan 2012 10:04 PM
[ Content Deleted ]
Report Abuse
TheShoeBox is not online. TheShoeBox
Joined: 20 Aug 2010
Total Posts: 5022
28 Jan 2012 10:06 PM
Well, can that work past 100?

Or no?
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
28 Jan 2012 10:09 PM
[ Content Deleted ]
Report Abuse
TheShoeBox is not online. TheShoeBox
Joined: 20 Aug 2010
Total Posts: 5022
28 Jan 2012 10:10 PM
Well, if I set it to green, and it started adding, then set it to red at five, would it reset it the "i=1,100" back to one?
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
28 Jan 2012 10:28 PM
    local x = script.Parent.Parent.GenColor
    local booleanValue = nil
    
    function onClicked(playerObject)
        if x.BrickColor == BrickColor.new("Lime green") then
            x.BrickColor = BrickColor.new("Really red")
            booleanValue = false
            while not booleanValue do
                script.Parent.val.Value = script.Parent.val.Value - 1
                wait(10)
            end
        elseif x.BrickColor == BrickColor.new("Really red") then
            x.BrickColor = BrickColor.new("Lime green")
            booleanValue = true
            while booleanValue do
                script.Parent.val.Value = script.Parent.val.Value + 1
                wait(10)
            end
        end
    end
    
    script.Parent.ClickDetector.MouseClick:connect(onClicked)

Try that.

{ Learning normal Lua and RBX.Lua. }
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