Why does this look so weird?

Hi,
I have a question, why does this look so weird?
It should change lighting in regions, for example in a cave it will get darker.

The place is uncopylocked.

I hope someone of you can help me!
Thanks :smiley:

2 Likes
  1. Are you sure this is for Scripting Support,
  2. Can you give us screenshots, of what you need help with.
1 Like

Yes, im sure.

ScreenShots not right now, but i want to achieve that when you walk into one of the two parts the lighting changes, the water properties, the terrain colors and some lighting effects change.

1 Like

Then a follow up question, as it’s already uncopylocked can you send the script(s) on here and
preformatted the text while you’re at it, to make it easy to read. (put 4 spaces in front of each line)

Mhm, there’s a script in Terrain. image
Edit: Delete the script if it’s unknown for you. (Mark as solution if it solved)

1 Like

The script is from a Plugin…
Here are the scripts:
ModuleScript With Settings in it(in StarterPlayerScripts)

local lighting = game.Lighting
local terrain = workspace.Terrain

local LightingSettings = {
	
	--||	Sumpf	  ||--
	Sumpf = {
		Lighting = {
			["FogEnd"] = 200;
			["FogStart"] = 0;
			["FogColor"] = Color3.new(32, 71, 0);
		};
		
		LightingEffects = {
			["TintColor"] = Color3.new(203, 255, 205);
		};
		
		TerrainSettings = {
			["WaterColor"] = Color3.new(4, 92, 0);
			["WaterReflectance"] = 0.25;
			["WaterTransparency"] = 0.02;
			["WaterWaveSize"] = 0;
			["WaterWaveSpeed"] = 3;
		};
	};
	
	--||	Standard  ||--
	Standard = {
		Lighting = {
			["FogEnd"] = lighting.FogEnd;
			["FogStart"] = lighting.FogStart;
			["FogColor"] = lighting.FogColor;
		} ;
		
		LightingEffects = {
			["TintColor"] = lighting.RegionColorCorrection.TintColor;
		};
		
		TerrainSettings = {
			["WaterColor"] = terrain.WaterColor;
			["WaterReflectance"] = terrain.WaterReflectance;
			["WaterTransparency"] = terrain.WaterTransparency;
			["WaterWaveSize"] = terrain.WaterWaveSize;
			["WaterWaveSpeed"] = terrain.WaterWaveSpeed;
		};
	};
	
}

return LightingSettings

Local script inside Module script:

local LightingRegionsWorkspace = workspace.LightingRegions
local RegionSettings = require(script.Parent)
local Sumpf = RegionSettings.Sumpf
local Standard = RegionSettings.Standard

local sumpfPartName = "Sumpf"
local standardPartName = "Standard"

local ts = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(3)

--|| Sumpf TweenGoals ||--
local sumpfTweenLightingGoals = {
	FogColor = Sumpf.Lighting.FogColor,
	FogEnd = Sumpf.Lighting.FogEnd, 
	FogStart = Sumpf.Lighting.FogStart
}

local sumpfTweenLightingEffectGoal = {
	TintColor = Sumpf.LightingEffects.TintColor
}

local sumpfTweenTerrainGoals = {
	WaterColor = Sumpf.TerrainSettings.WaterColor, 
	WaterReflectance = Sumpf.TerrainSettings.WaterReflectance, 
	WaterTransparency = Sumpf.TerrainSettings.WaterTransparency, 
	WaterWaveSize = Sumpf.TerrainSettings.WaterWaveSize,
	WaterWaveSpeed = Sumpf.TerrainSettings.WaterWaveSpeed
}

--|| Normal TweenGoals ||--
local StandardTweenLightingGoals = {
	FogColor = Standard.Lighting.FogColor,
	FogEnd = Standard.Lighting.FogEnd, 
	FogStart = Standard.Lighting.FogStart
}

local StandardTweenLightingEffectGoal = {
	TintColor = Standard.LightingEffects.TintColor
}

local StandardTweenTerrainGoals = {
	WaterColor = Standard.TerrainSettings.WaterColor, 
	WaterReflectance = Standard.TerrainSettings.WaterReflectance, 
	WaterTransparency = Standard.TerrainSettings.WaterTransparency, 
	WaterWaveSize = Standard.TerrainSettings.WaterWaveSize,
	WaterWaveSpeed = Standard.TerrainSettings.WaterWaveSpeed
}


local found = false

while wait(1) do
	for i, v in pairs(LightingRegionsWorkspace:GetChildren()) do
		for l, o in pairs(v:GetChildren()) do
			if o:IsA("Part") then
				found = false
				local newRegion = Region3.new(o.Position - (o.Size/2), o.Position + (o.Size/2))
				
				local parts = workspace:FindPartsInRegion3WithWhiteList(newRegion, game.Players.LocalPlayer.Character:GetDescendants())
				
				for _, part in pairs(parts) do
					if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
						found = true
						break
					else
						found = false
					end
				end
				
				if found then
					print("PlayerFoundInLightingRegion")
					if o.Name == standardPartName then
						local standardtween1 = ts:Create(game.Lighting, tweenInfo, StandardTweenLightingGoals)
						local standardtween2 = ts:Create(game.Lighting.RegionColorCorrection, tweenInfo, StandardTweenLightingEffectGoal)
						local standardtween3 = ts:Create(workspace.Terrain, tweenInfo, StandardTweenTerrainGoals)
						
						standardtween1:Play()
						standardtween2:Play()
						standardtween3:Play()
						break
					elseif o.Name == sumpfPartName then
						local standardtween1 = ts:Create(game.Lighting, tweenInfo, sumpfTweenLightingGoals)
						local standardtween2 = ts:Create(game.Lighting.RegionColorCorrection, tweenInfo, sumpfTweenLightingEffectGoal)
						local standardtween3 = ts:Create(workspace.Terrain, tweenInfo, sumpfTweenTerrainGoals)
						
						standardtween1:Play()
						standardtween2:Play()
						standardtween3:Play()
						break
					end
				end
			end
		end
	end
end
1 Like

I joined the game, touched a part and this happened:


What is the problem you are looking to solve?

The reason why the lighting looks so bright is because when you change the fogcolor, you are currently using Color3.new instead of Color3.fromRGB. “.fromRGB” will use the correct values. Replace all the Color3.new to Color3.fromRGB in your module script, and this should resolve the problem.

This is your fixed module script :slight_smile:

local lighting = game.Lighting
local terrain = workspace.Terrain

local LightingSettings = {
	
	--||	Sumpf	  ||--
	Sumpf = {
		Lighting = {
			["FogEnd"] = 200;
			["FogStart"] = 0;
			["FogColor"] = Color3.fromRGB(32, 71, 0);
		};
		
		LightingEffects = {
			["TintColor"] = Color3.fromRGB(203, 255, 205);
		};
		
		TerrainSettings = {
			["WaterColor"] = Color3.fromRGB(4, 92, 0);
			["WaterReflectance"] = 0.25;
			["WaterTransparency"] = 0.02;
			["WaterWaveSize"] = 0;
			["WaterWaveSpeed"] = 3;
		};
	};
	
	--||	Standard  ||--
	Standard = {
		Lighting = {
			["FogEnd"] = lighting.FogEnd;
			["FogStart"] = lighting.FogStart;
			["FogColor"] = lighting.FogColor;
		} ;
		
		LightingEffects = {
			["TintColor"] = lighting.RegionColorCorrection.TintColor;
		};
		
		TerrainSettings = {
			["WaterColor"] = terrain.WaterColor;
			["WaterReflectance"] = terrain.WaterReflectance;
			["WaterTransparency"] = terrain.WaterTransparency;
			["WaterWaveSize"] = terrain.WaterWaveSize;
			["WaterWaveSpeed"] = terrain.WaterWaveSpeed;
		};
	};
	
}

return LightingSettings

Thanks :smiley:
I accualy wanted to try Color3.fromRGB.
But yea still thanks :smiley: