so basically, im trying to make an exposurecompensation script, but it doesn’t work. it works once when you climb up a truss with something above it as a ceiling. i want it to lower to 0 outside, raise to 1 inside. tried on devforum discord and sh discord and got no luck. it doesnt lower outside, nor raise inside.
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local head = player.Character:WaitForChild("Head")
function raiseExposure()
local exposure = math.clamp(0,0,1)
for i = 1,10 do
wait()
exposure = exposure +0.1
game.Lighting.ExposureCompensation = exposure
end
end
function lowerExposure()
local exposure = math.clamp(0,0,1)
for i = 1,10 do
wait()
exposure = exposure -0.1
game.Lighting.ExposureCompensation = exposure
end
end
function castRay()
local originVector3 = head.Position
local castDirection = head.CFrame.UpVector
local castParameters = RaycastParams.new()
castParameters.FilterDescendantsInstances = {head.Parent}
castParameters.FilterType = Enum.RaycastFilterType.Blacklist
local castResult = workspace:Raycast(originVector3, castDirection, castParameters)
if castResult then
local hitPart = castResult.Instance
if hitPart.Transparency <=.8 then
raiseExposure()
elseif not castResult and not hitPart then
lowerExposure()
end
end
end
while wait(.1) do
castRay()
end