Tweening Atmosphere / Lightning Being Weird?

Hello! I’m currently trying to make a script that would animate the Atmosphere & the Lightning to match the dictionary named “newAtmosphere”. However, no matter what I do, it seems to give me an error about a property not being the property of the given object even though it literally is (for example, decay not being the property of Atmosphere)? I’m not really familiar with tween stuff, even scripting in general so any kind of help would matter a lot to me.

I’ve tried changing the Atmosphere with Lightning, I’ve tried deleting the properties in the dictionaries that could not have been the properties of the actual object but none of them worked so I’m really confused.

  local newAtmosphereColor = Atmosphere.Color == Color3.new(0, 0, 0)
  local newAtmosphereDecay = Atmosphere.Decay == Color3.new(0, 0, 0)
  local newAmbient = game.Lighting.Ambient == Color3.new(0, 0, 0)
  local newOutdoorAmbient = game.Lighting.OutdoorAmbient == Color3.new(0, 0, 0)
  local newBrightness = game.Lighting.Brightness == 10
  local newGlare = game.Lighting.Atmosphere.Glare == 0

^ these are the variables that I wrote in the “newAtmosphere” dictionary.

local defaultAtmosphere = {
	
			color = Atmosphere.Color,
			decay = Atmosphere.Decay,
			glare = Atmosphere.Glare,
			brightness = game.Lighting.Brightness,
			ambient = game.Lighting.Ambient,
			outdoorAmbient = game.Lighting.OutdoorAmbient
	
		}
		
		
		local newAtmosphere = {

			color = newAtmosphereColor,
			decay = newAtmosphereDecay,
			glare = newGlare,
			brightness = newBrightness,
			ambient = newAmbient,
			outdoorAmbient = newOutdoorAmbient


		}
		
		
		local transition = TweenService:Create(Atmosphere, TweenInfo.new(10), newAtmosphere)
		
		transition:Play()

^ This is the code itself.

 TweenService:Create no property named 'ambient' for object 'Atmosphere'

^ This is one of the examples that Studio gives as an error, I know that ‘Ambient’ is not a property of ‘Atmosphere’ but it happens to any property, including ‘Decay’, ‘Glare’, etc.

I would be glad to know what may be causing this but I also would accept the recommendations about what other ways I could simply animate atmosphere / lightning. Again, I’m really bad at scripting so I would want it to be as simple as possible.

The reason this error is here is because there isn’t any Property telling it what it is or what color it is
You are also Mispelling their Names, their names have to be Exactly as their Property to work

            Color = Atmosphere.Color,
			Decay = Atmosphere.Decay,
			Glare = Atmosphere.Glare,
			Brightness = game.Lighting.Brightness,
			Ambient = game.Lighting.Ambient,
			OutdoorAmbient = game.Lighting.OutdoorAmbient

Spelling the names correctly seems to have gotten rid of the error but now another error shows up and says that some properties cannot be tweened due to type mismatch and that property is a ‘color3’ and the given type is a ‘bool’. How can I fix that?

should I write Decay.Color3 = Atmosphere .Color instead or something like that?

local Properties = {
Color = Color3.fromRGB(0, 0, 0);
Decay = Color3.fromRGB(0, 0, 0);
Glare = 0;
Haze = 0;
Density = .3;
Offset = 0;
}

T = TweenService:Create(Atmosphere, TweenInfo.new(10), Properties)
T:Play()


Do the Lighting and Atmosphere Tween Seperatley, It is looking for stuff inside Atmosphere, not Lighting

2 Likes

Can I just get rid of all the ‘local’ variables since I’m gonna write the values in the dictionary anyway?

Variable1 = nil -- Global Variable
local Variable -- Local Variable

Alright seems to have worked out fine for now, thank you for the help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.