I am trying to make areas of different lighting in my game, but I don’t know a lot about lighting. How would I change the lighting settings (like fog or ambient color) for one player? I’ve tried putting it in a script/local script but I don’t know if that will change for all players or just the one I want. Thanks!
If you want the lighting to change for one player simply just use a localscript and a touch event or Region3
You can also make a transition with tween service between different colors
If you aren’t working 3D/layered zones, then you can just put invisible bricks under the map. Use a LocalScript that will, every Heartbeat, shoot a raycast downwards from the character HumanoidRootPart to check for one of these zones in a whitelist (so that only these parts can be detected in the raycast). Determine what zone you are in based on what the cast hits, then update lighting accordingly.
Yup, the best thing you can do as colbert said is using raycasts to check the area.
I recently made a similar script for a Roblox Game Jam so feel free to use it or modify it
RunService.Heartbeat:Connect(function()
local SnowyScreenRaycastParams = RaycastParams.new()
SnowyScreenRaycastParams.FilterDescendantsInstances = SnowyFilterParts
SnowyScreenRaycastParams.FilterType = Enum.RaycastFilterType.Whitelist
local Result = workspace:Raycast(Hrp.Position, Vector3.new(0, 150, 0), SnowyScreenRaycastParams)
if (not Result and not Result.Instance) then
SnowScreenEffectEnabled = true
TweenService:Create(game.Lighting, SnowyTweenInfo, {FogEnd = 75, FogStart = 0}):Play()
TweenService:Create(Snowy0, SnowyTweenInfo, {ImageTransparency = .9}):Play()
TweenService:Create(Snowy1, SnowyTweenInfo, {ImageTransparency = .9}):Play()
elseif (Result and Result.Instance ~= nil) then
SnowScreenEffectEnabled = false
TweenService:Create(game.Lighting, SnowyTweenInfo, {FogEnd = 125, FogStart = 25}):Play()
TweenService:Create(Snowy0, SnowyTweenInfo, {ImageTransparency = 1}):Play()
TweenService:Create(Snowy1, SnowyTweenInfo, {ImageTransparency = 1}):Play()
end
end)
You maybe should add some short of debounce or something similar to avoid the script executing unnecessary tweens.