local function IsDark()
if dark then
print("Its dark")
return true
else
print("Not dark!")
return false
end
end
while task.wait() do
local dark = IsDark()
end
You could, but thatās not counting how some UGC are not affected by light on purpose (eg. cartoony outline), which would lead to some parts of the player always being set to rgb 0,0,0 and tripping up your system.
an alternative method is to do raycasts from avatar to the outside. if more than a threshold % of those raycast hit something, then we are āin enclosureā.
It can distinguish outdoor area from non-illuminated caves/rooms/etc. but this cannot know if a portion of indoor area is lit or not.