Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Locally change fog with onTouched brick?

Asked by
nicros 165
8 years ago

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)

1 answer

Log in to vote
1
Answered by 8 years ago

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

0
hehe thanks, yeah ive heard FilteringEnabled is a nightmare so im probably going to just set a default fog for everywhere. nicros 165 — 8y
0
How is Filtering Enabled a nightmare? EzraNehemiah_TF2 3552 — 8y
0
I've tried. You have to use remote events for almost everything. deputychicken 226 — 8y
Ad

Answer this question