so ive got an rpg and im pretty noob at Lua so sorry if this is a basic question
ive got different areas and i want each area to have its own view distance fog, so when they walk through to the next area it sets their fog locally when they touch the brick
here is the script ive got which changes the whole games fog distance, idk how to change it to set it locally for the person who touched it
function onTouched(hit) game.Lighting.FogEnd = ("250") end script.Parent.Touched:connect(onTouched)
To set it locally, you'd have to use FilteringEnabled. Which is a pain in the rear end. Believe me. A way to do this would be to create fog as a model or something, then do this: IN THE SCRIPT
function onTouched(hit) local localfog = script.LocalFog:Clone() localfog.Parent = hit.Parent localfog.Disabled = false end
Then put a local script named "LocalFog" in the script that is disabled. This script would say something like:
local Camera = game.Workspace.CurrentCamera local Fog = game.ReplicatedStorage.Fog:Clone() -- Replace game.ReplicatedStorage.Fog with whatever your FOG model is and where it is located. Fog.Parent = Camera