Creating fog/atmosphere in a certain part of the Map

Hi,

Im looking to have fog (specifically the one you get from adding the ‘atmosphere’ node under Lighting) operate only in certain parts of the map (aka my lobby). However I haven’t found too much either on the dev forum or elsewhere about if this can be done. This is how far I got trying to make it (doesn’t work at present). Anyone got any ideas? Script is below:

local regionsWorkSpace = game.Workspace:WaitForChild("Regions")

local Found = false

while wait(1) do
	for i, v in pairs (regionsWorkSpace:GetChildren()) do
		
		local Found = false
		local region = Region3.new(v.Position - (v.Size/2), v.Position + (v.Size/2))
		
		local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, 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 == true then
			local atmosphere= Instance.new("Atmosphere")
			atmosphere.Parent = game.Lighting
		end
	end
end

Thanks!

Hmm why u don’t make a part that when touched, active that, and when touch end, disable.

Well the main issue is that I dont think the atmosphere actually gets added (doesnt show up under the Lighting section when im in the area)

Is only active/deactivate with Lighting.NameOfThing.Enabled = true/false

1 Like

I personally keep different atmoshpheres in replicated storage, you can do values for fog as well, then have a location script that sets the lighting locally to the locations presets whenever the player enters.

Enabled isnt an aspect of lighting effects I dont believe.

It is, I use to make some games with lighting chances in some locations.

12:47:42.465 Enabled is not a valid member of Atmosphere “Lighting.Atmosphere” - Client - LocalScript:2

So try to put the atmosphere values in 0 and change to the value you want when go to the place

1 Like