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 » Scripters
Home Search
 

Re: FogColor can't be changed through increment?

Previous Thread :: Next Thread 
thelolguy301 is online. thelolguy301
Joined: 27 Sep 2011
Total Posts: 2997
12 Jun 2015 08:10 AM
for i=1, 64 do
game.Lighting.FogColor = game.Lighting.FogColor + Color3.new(64,64,64)
wait()
end
for i=1, 64 do
game.Lighting.FogColor = game.Lighting.FogColor + Color3.new(0,31,31)
wait()
end

Error occurs;
- game.Lighting.FogColor = game.Lighting.FogColor + Color3.ne:1: attempt to perform arithmetic on field 'FogColor' (a userdata value)
- Stack Begin
- Script 'game.Lighting.FogColor = game.Lighting.FogColor + Color3.ne', Line 1
- Stack End
Report Abuse
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Jun 2015 08:21 AM
Color3s use values ranging from 0 to 1, even though the studio properties tab shows them as values from 0 to 255. Most people fix it like this:

Color3.new(64/255, 64/255, 64/255)
Color3.new(0, 31/255, 31/255)

This has nothing to do with the error though, but the colors would be wrong if you did set them.
As for the error, you can't use addition with Color3 values. You'd have to do something like this:

local Current = game.Lighting.FogColor
local New = Color3.new(64/255, 64/255, 64/255)
game.Lighting.FogColor = Color3.new(Current.r + New.r, Current.g + New.g, Current.b + New.b)

~The herp lerped a derp~
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
12 Jun 2015 08:34 AM
I dont want to be rude but all these famous ppl get scripts from us and give no credit

they make us slaves.
Report Abuse
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Jun 2015 08:38 AM
@iSpecializinq

"famous" people are no different from anyone else here on ROBLOX. They deserve our help just as much or just as little as anyone else does. And I don't mean to be rude either, but if you're posting only to criticize, it's better if you don't post at all.

~The herp lerped a derp~
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
12 Jun 2015 08:40 AM
You just did the same, and you missed my point.

You are closed minded, tbh.

That is not at ALL what I ment.

Im talking the ppl who ask for help (mostly the famous ppl in this case), we help, and then they say they had no help.
Report Abuse
thelolguy301 is online. thelolguy301
Joined: 27 Sep 2011
Total Posts: 2997
12 Jun 2015 09:24 AM
Still don't get it. So how would I make it add [1, 1, 1] to a Color3 value?
Report Abuse
thelolguy301 is online. thelolguy301
Joined: 27 Sep 2011
Total Posts: 2997
12 Jun 2015 09:26 AM
Also I think it's pretty obvious that most developers get help. Developers just simply need less help than others.

I've never seen any developer claim they did everything by themselves. Nor do I believe they'd be respected game creators of they did anyway.
Report Abuse
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Jun 2015 09:48 AM
Color3s are based on values ranging from 0-255, but they are set in a script using values ranging from 0-1. So you have to set them as x/255, where x is the color you want.

Color3 also does not have the ability to be added to or subtracted from (don't know why, ask roblox), so you have to add and subtract the separate properties. So if you wanted to do this:

game.Lighting.FogColor = game.Lighting.FogColor + Color3.new(1/255, 1/255, 1/255)

You would instead have to do this:

game.Lighting.FogColor = Color3.new(game.Lighting.FogColor.r + 1/255, game.Lighting.FogColor.g + 1/255, game.Lighting.FogColor.b + 1/255)

~The herp lerped a derp~
Report Abuse
thelolguy301 is online. thelolguy301
Joined: 27 Sep 2011
Total Posts: 2997
12 Jun 2015 02:36 PM
I sort of made it more enhanced. ;s sorry.
This is what I finally coded:

l = game:service("Lighting")
appliers = {
Color3.new(1/255, 1/255, 1/255),
Color3.new(0, 1/255, 1/255),
Color3.new(0, 0, 1/255),
Color3.new(-1/255, -1/255, -1/255),
Color3.new(0, -1/255, -1/255),
Color3.new(0, 0, -1/255),
Color3.new(-1/255,1/255,1/255),
Color3.new(-1/255,0,1/255)
}

local function convert_ambient(currentTime,nextTime)
if currentTime == "morning" and nextTime == "day" then
l.FogEnd = math.random(2500,3000)
for i=1,61 do
l.OutdoorAmbient = Color3.new(l.OutdoorAmbient.r+appliers[1].r,l.OutdoorAmbient.g+appliers[1].g,l.OutdoorAmbient.b+appliers[1].b)
wait()
end
for i=1,30 do
l.OutdoorAmbient = Color3.new(l.OutdoorAmbient.r+appliers[2].r,l.OutdoorAmbient.g+appliers[2].g,l.OutdoorAmbient.b+appliers[2].b)
wait()
end
end

while true do
if l.TimeOfDay == "05:25:00" then
convert_ambient("night","morning")
end

if l.TimeOfDay == "07:00:00" then
convert_ambient("morning","day")
end

if l.TimeOfDay == "18:00:00" then
convert_ambient("day","evening")
end

if l.TimeOfDay == "20:40:00" then
convert_ambient("evening","night")
end
wait()
end
Report Abuse
ProMG4 is not online. ProMG4
Joined: 21 Jul 2011
Total Posts: 26
16 Sep 2015 12:52 PM
You didnt need to make it use that much functions to change the time of day, an easier way of making the time of day change is...

while true do
wait(a time)
l:SetMinutesAfterMidnight(l:GetMinutesAfterMidnight()+1)
end
Report Abuse
ProMG4 is not online. ProMG4
Joined: 21 Jul 2011
Total Posts: 26
16 Sep 2015 12:53 PM
sry i didnt read the script properly xD. K, so how do i delete posts?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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