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
 

Colorchange brick that can stop

Previous Thread :: Next Thread 
Dwarlon is not online. Dwarlon
Joined: 18 Jul 2013
Total Posts: 4604
14 Oct 2013 09:16 PM
I can make a brick randomly color, but that is the easy part.

I need to know how to make it turn "Really Black" on click, but when it is clicked again turn on.
So far, I have:

script.Parent = t
while true do
t.BrickColor = BrickColor.ReallyBlack()
end
function onclicked



t.ClickDetector.MouseClick:connect(onClicked)

Please help :)
Report Abuse
Dwarlon is not online. Dwarlon
Joined: 18 Jul 2013
Total Posts: 4604
14 Oct 2013 09:17 PM
WHOOPS!!! I meant Brickcolor.Random xP
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
14 Oct 2013 09:18 PM
script.Parent = t
function onClicked()
t.BrickColor = t.BrickColor == BrickColor.new("Really black") and BrickColor.new("Bright blue") or BrickColor.new("Really black")
end



t.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
14 Oct 2013 09:20 PM
Change
t.BrickColor = t.BrickColor == BrickColor.new("Really black") and BrickColor.new("Bright blue") or BrickColor.new("Really black")

to:
t.BrickColor = t.BrickColor == BrickColor.new("Really black") and BrickColor.Random() or BrickColor.new("Really black")

if you want it to be black or random
Report Abuse
Dwarlon is not online. Dwarlon
Joined: 18 Jul 2013
Total Posts: 4604
14 Oct 2013 09:23 PM
Hold up. I think you might have gotten it wrong.

I want it to be changing random automatically, but if you click it, it will stay only "Really black" Until you click it again, which will make it random.

Is there any way to make it where "Brickcolor.random" Exclude "Really Black"?

If I could do that, I could make it myself.
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
14 Oct 2013 09:28 PM
random = true
t = script.Parent

function GetRandomColor()
local = color = BrickColor.Random()
if color == BrickColor.new("Really black") then
color = GetRandomColor()
end
return color
end

function startrandom()
while random do
wait(4)
t.BrickColor = GetRandomColor()
end
end

t.ClickDetector.MouseClick:connect(function()
random = not random
if random then startrandom() end
end)
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
14 Oct 2013 09:29 PM
i forgot to make the part black when random = false

random = true
t = script.Parent

function GetRandomColor()
local = color = BrickColor.Random()
if color == BrickColor.new("Really black") then
color = GetRandomColor()
end
return color
end

function startrandom()
while random do
wait(4)
t.BrickColor = GetRandomColor()
end
end

t.ClickDetector.MouseClick:connect(function()
random = not random
t.BrickColor = random and GetRandomColor() or BrickColor.new("Really black")
if random then startrandom() end
end)
Report Abuse
Dwarlon is not online. Dwarlon
Joined: 18 Jul 2013
Total Posts: 4604
14 Oct 2013 09:30 PM
Okee Dokee. Haven't tested it, but it will most likely work.

+Respect since you're a 08'er
+Respect since you were patient with me
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