edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 04 Apr 2013 05:29 PM |
I am using these lines of code;
function ch() if game.Lighting.FogEnd ~= script.Parent.FogDist.Value or game.Lighting.FogColor ~= script.Parent.FogCol.Value then game.Lighting.FogEnd = script.Parent.FogDist.Value game.Lighting.FogColor = Color3.new(script.Parent.FogCol.Value) end end
game.Lighting.Changed:connect(ch);
script.Parent.FogDist.Changed:connect(function() game.Lighting.FogEnd = script.Parent.FogDist.Value; game.Lighting.FogColor = Color3.new(script.Parent.FogCol.Value); end)
script.Parent.FogCol.Changed:connect(function() game.Lighting.FogEnd = script.Parent.FogDist.Value; game.Lighting.FogColor = Color3.new(script.Parent.FogCol.Value); end)
The script changes the lighting of the game depending on values in the players hopperbin. The final function is not picked up however, and thus the games fog colour never changes.
Throughout the script, the FogColor never changes in game, and I am unsure as to why. Any help? |
|
|
| Report Abuse |
|
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
| |
|
lordsheen
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 608 |
|
|
| 05 Apr 2013 04:48 PM |
game.Lighting.Changed:connect(function() if game.Lighting.FogEnd ~= script.Parent.FogDist.Value or game.Lighting.FogColor ~= script.Parent.FogCol.Value then game.Lighting.FogEnd = script.Parent.FogDist.Value game.Lighting.FogColor = Color3.new(script.Parent.FogCol.Value) end end
end) |
|
|
| Report Abuse |
|
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 05 Apr 2013 05:18 PM |
While it works, I have realised the error.
The Color3Vals are all coming out wrong. The line;
script.Parent.FogCol.Value = Color3.new(0, 37, 57)
Actually makes the FogCol value come out as (45700, 0, 0)
Is there any way I can fix this? |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 05 Apr 2013 06:01 PM |
"Color3 values only range from 0 to 1. Many people prefer to use a system with a range of 255 instead of a range of one. Here is a useful piece of code:"
You need to divide each number by 255. |
|
|
| Report Abuse |
|
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
| |
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 05 Apr 2013 06:14 PM |
Now the values come out as 0 :/
|
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 05 Apr 2013 06:57 PM |
Are you sure you're doing...
script.Parent.FogCol.Value = Color3.new(0, 37/255, 57/255)
|
|
|
| Report Abuse |
|
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 06 Apr 2013 07:23 AM |
| That's the line I'm using. However it is still all black :( |
|
|
| Report Abuse |
|
|