Cravitus
|
  |
| Joined: 03 Aug 2012 |
| Total Posts: 139 |
|
|
| 15 Jul 2013 02:06 PM |
Trying to attach a script for a toggleable light to a gun I'm making.
That said, right now I just want to get the light's brick to change from black to shiny white.
What I have is not working.
function Flashlight() if key == "F" then wait(0.4) Light = {tool.Light} if Light.Brickcolor "Really black" then Light.Brickcolor = BrickColor.new("Institutional white") Light.Reflectance = 0.5 else Light.Brickcolor = BrickColor.new ("Really Black") Light.Reflectance = 0 end end end
What am I doing wrong? |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 15 Jul 2013 02:07 PM |
| No object in Roblox has a property named "Brickcolor". I suspect that you meant "BrickColor". |
|
|
| Report Abuse |
|
|
Cravitus
|
  |
| Joined: 03 Aug 2012 |
| Total Posts: 139 |
|
|
| 15 Jul 2013 02:08 PM |
| Ah, that may be the problem. First time scripter. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 15 Jul 2013 02:09 PM |
| Also, `Light` is probably not meant to be a table. I suggest removing those curly brackets around "tool.Light", as you mean to use it as an Instance. |
|
|
| Report Abuse |
|
|
Cravitus
|
  |
| Joined: 03 Aug 2012 |
| Total Posts: 139 |
|
|
| 15 Jul 2013 02:29 PM |
Bump.
function Flashlight() wait(0.4) if Tool.light.BrickColor "Really black" then Tool.light.BrickColor = BrickColor.new("Light blue") Tool.light.Reflectance = 0.5 else Tool.light.BrickColor = BrickColor.new ("Really Black") Tool.light.Reflectance = 0 end end
Still not working, but I think it has something to do with the keypress.
function KeyDownFunctions(key) if key == "r" then Reload() end if key == "F" then Flashlight() end end |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2013 02:39 PM |
Tool.light.BrickColor "Really black"
Tool.light.BrickColor == BrickColor.new("Really black") |
|
|
| Report Abuse |
|
|
| |
|
Cravitus
|
  |
| Joined: 03 Aug 2012 |
| Total Posts: 139 |
|
|
| 15 Jul 2013 02:48 PM |
| Doesn't seem to work, though the gun's been working the way it should the entire time. 'Cept for the flashlight of course. |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2013 02:57 PM |
| Oh, and your 'F' needs to be 'f'. |
|
|
| Report Abuse |
|
|
Cravitus
|
  |
| Joined: 03 Aug 2012 |
| Total Posts: 139 |
|
| |
|