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
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.