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: Hello! Simple color script i can get to work..

Previous Thread :: Next Thread 
H1M is not online. H1M
Joined: 11 Apr 2009
Total Posts: 218
20 Nov 2012 06:17 AM
Ok so I just got into lua, and I am trying to make a script so that when you hit a brick it changes color.... but if it is already that color.. I want it to change in to another color...

this is tha script I am using.

function onTouched(part)

if script.Parent.BrickColor == ("Toothpaste")

then script.Parent.BrickColor = BrickColor.new("Bright blue") else

script.Parent.BrickColor = BrickColor.new("Toothpaste")


end


end

script.Parent.Touched:connect(onTouched)



Can any one help me?
Report Abuse
awas3 is not online. awas3
Joined: 24 Oct 2010
Total Posts: 2854
20 Nov 2012 06:31 AM
debounce = false

function onTouched()
if debounce == false then
debounce = true
if script.Parent.BrickColor == BrickColor.new("Toothpaste") then
script.Parent.BrickColor = BrickColor.new("Bright blue")
else
script.Parent.BrickColor = BrickColor.new("Toothpaste")
wait(2)
debounce = false
end
end
end

script.Parent.Touched:connect(onTouched)


--The script will work every 2 seconds. When you touch the part once, it will take 2 seconds before you can touch it again

~A3~
Report Abuse
H1M is not online. H1M
Joined: 11 Apr 2009
Total Posts: 218
20 Nov 2012 06:39 AM
Thank you!
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