robb12
|
  |
| Joined: 09 Jul 2009 |
| Total Posts: 32076 |
|
|
| 07 Jan 2017 01:56 AM |
why wont it change color D ::::::::::::::::::
function onClicked() buttoncolor = math.random(1,3) if buttoncolor == 1 then script.Parent.BrickColor = "Pastel Blue" if buttoncolor == 2 then script.Parent.BrickColor = "Camo" if buttoncolor == 3 then script.Parent.BrickColor = "Really red" end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
|
|
| Report Abuse |
|
|
|
| 07 Jan 2017 01:59 AM |
the only two things I see weird here- however this is coming from a java scripter not lua but they're similar- is that you have buttoncolor = math.random(1,3), and that's a command to generate a random color or random SOMETHING connected to a value ( at least in java).
Only other thing I can think of is maybe you aren't pointing to the correct brick when you say script.Parent.BrickColor = "Pastel Blue". |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2017 02:00 AM |
NEVERMIND, YOU'RE JUST SCREWING UP THE COLOR NAMES.
REALLY RED ISN'T 'Really Red" it's "really Red"
first word = non capitalized, second word capitalized |
|
|
| Report Abuse |
|
|
robb12
|
  |
| Joined: 09 Jul 2009 |
| Total Posts: 32076 |
|
| |
|
Qivr
|
  |
| Joined: 22 Aug 2014 |
| Total Posts: 5407 |
|
|
| 07 Jan 2017 02:06 AM |
buttoncolor = math.random(1,3) if buttoncolor == 1 then script.Parent.BrickColor = "Pastel Blue" elseif buttoncolor == 2 then script.Parent.BrickColor = "Camo" elseif buttoncolor == 3 then script.Parent.BrickColor = "Really red" end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Jan 2017 02:17 AM |
local colours = {"Pastel blue"; "Really red"; "New Yeller"} -- add more in here function onClicked() script.Parent.BrickColor = BrickColor.new(colors[math.random(#colours)]) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
-------------------
The problem you had was you were: #1 not properly ending the if statements #2 not properly assigning brickcolor (which takes brickcolor, not a string)
#1 was a redundant issue, if statements aren't necessary. infact, what i gave you is inefficient there is a better way to do it because we're creating a new brickcolor every time you click. plus, __index calls to the parent, tsk tsk.
Qivr is wrong. |
|
|
| Report Abuse |
|
|
Qivr
|
  |
| Joined: 22 Aug 2014 |
| Total Posts: 5407 |
|
|
| 07 Jan 2017 02:18 AM |
Ow Poly! I honestly did not look deep into the script, I saw it was if statements that ran on and did not use "elseif" sorry I disappointed you dad :(
|
|
|
| Report Abuse |
|
|
55Altair
|
  |
| Joined: 18 Oct 2008 |
| Total Posts: 6272 |
|
|
| 07 Jan 2017 02:23 AM |
for the record i just directly fixed his script and it worked but poly's didn't
function onClicked()
buttoncolor = math.random(1,3) if buttoncolor == 1 then script.Parent.BrickColor = BrickColor.new("Pastel Blue") else if buttoncolor == 2 then script.Parent.BrickColor = BrickColor.new("Camo") else if buttoncolor == 3 then script.Parent.BrickColor = BricckColor.new("Really red") end end end end
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
| |
|
robb12
|
  |
| Joined: 09 Jul 2009 |
| Total Posts: 32076 |
|
|
| 07 Jan 2017 02:24 AM |
um they both work
you are both very powerful.... |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2017 02:24 AM |
opps, i made a stupid mistake.
BrickColor.new(colors[math.random(#colours)])
"colors[" should be "colours["
thats what i get for being canadian. |
|
|
| Report Abuse |
|
|
55Altair
|
  |
| Joined: 18 Oct 2008 |
| Total Posts: 6272 |
|
|
| 07 Jan 2017 02:24 AM |
| looks like i am truly the superior programmer |
|
|
| Report Abuse |
|
|
| |
|
robb12
|
  |
| Joined: 09 Jul 2009 |
| Total Posts: 32076 |
|
|
| 07 Jan 2017 02:26 AM |
ok polys script makes the brick turn grey sometimes
into the trash it goes |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2017 02:29 AM |
"ok polys script makes the brick turn grey sometimes into the trash it goes"
thats because your incompetence is spelling the colour wrong. NOT MY FAULT. |
|
|
| Report Abuse |
|
|
Qivr
|
  |
| Joined: 22 Aug 2014 |
| Total Posts: 5407 |
|
|
| 07 Jan 2017 02:30 AM |
| ######################################################################################################################################################################################################################################################################################### |
|
|
| Report Abuse |
|
|
55Altair
|
  |
| Joined: 18 Oct 2008 |
| Total Posts: 6272 |
|
|
| 07 Jan 2017 02:31 AM |
| I put Poly's script in my fort now my team spawns with Admiral pistols wtf? |
|
|
| Report Abuse |
|
|
lork
|
  |
| Joined: 19 Jun 2008 |
| Total Posts: 7166 |
|
|
| 07 Jan 2017 02:31 AM |
| hey lay off my friend or things are gonna ### ###### ##### for u bud |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2017 02:31 AM |
| altair can i put you in my fort. |
|
|
| Report Abuse |
|
|
robb12
|
  |
| Joined: 09 Jul 2009 |
| Total Posts: 32076 |
|
|
| 07 Jan 2017 02:31 AM |
| you win this round monochromatic degenerate |
|
|
| Report Abuse |
|
|
55Altair
|
  |
| Joined: 18 Oct 2008 |
| Total Posts: 6272 |
|
| |
|
|
| 07 Jan 2017 02:32 AM |
| im gonna have a lot of fun :P |
|
|
| Report Abuse |
|
|
55Altair
|
  |
| Joined: 18 Oct 2008 |
| Total Posts: 6272 |
|
|
| 07 Jan 2017 02:34 AM |
| plz steam me what my character is gonna be doing in ur fort because i dont intend on raiding on this game ever again |
|
|
| Report Abuse |
|
|
robb12
|
  |
| Joined: 09 Jul 2009 |
| Total Posts: 32076 |
|
|
| 07 Jan 2017 02:35 AM |
| the admiral is gonna fire his pistol in your mouth |
|
|
| Report Abuse |
|
|