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

How do I Detect Darkness?

Asked by 8 years ago

So with the new bloom effect I want to make it so if a player is in a dark area outside is really bright and it gets brighter the longer they spend in the dark and when they go outside they slowly adjust to it and the bloom decreases. Except is it even possible to detect how much a area is lit?

0
Just go into the bloom properties and change it when the player hits a transparent brick. DrCylonide 158 — 8y
0
I sadly don't think you can. You would have to do the above suggestion or use magnitude. I will say however that the bloom effect only works if a player's quality level is six or higher, and the sun rays effect only works if the player's quality is eight or higher. User#11440 120 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

ofcourse it is possibal. for example you can place this into a local script

local plr = game.Players.LocalPlayer
local blurmultiplyer = 1
while wait() do
for i, v in pairs(workspace:GetChildren()) do
if v:IsA("BasePart") and ((plr.Character.Torso.CFrame.p-v.CFrame.p).magnitude)<15 then
if v:GetChildren=~nil then
for i, t in pairs(v:GetChildren()) do
if t:IsA("Point Light" or "Spot light") then
blurmultiplyer = blurmultiplyer - 0.1
wait(1)
else
blurmultiplyer = blurmultiplyer + 0.1
wait(1)
end
end
else
blurmultiplyer = blurmultiplyer + 0.1
wait(1)
end
end
end
end
Then make a few other lines that when they are exposed to light the bloom property changes.

consider also using a raycast to see if the player is beneath any parts and therefor cannot see the light. lastly you can check the time of day aswell.

0
/: User#11440 120 — 8y
0
This only checks for point/spot lights. Furthermore if you have a dark building with no lights but the time of day is still 'day' then it wont work either. LifeInDevelopment 364 — 8y
Ad

Answer this question