Sunrays show even when the sun is disabled

SunRaysBug Repro.rbxl (557.4 KB)

When SkyBox.CelestialBodiesShown = false, the game still displays sunrays as if SkyBox.CelestialBodiesShown = true. Expected behavior is that sunrays are hidden if the sun is hidden through Skybox.CelestialBodiesShown = false.

You need to set your Quality to 10 to see it.


Is this really a bug though?


I believe this is intentional (eg. Sunrays on skyboxes with a built in sun). If you don’t want sunrays, disable the sunray effect.


If you want to sync the sun rays visibility to the celestial body property, here’s how you could do it:

local sky = game:GetService("Lighting").Sky
local sunRays = game:GetService("Lighting").SunRays

local function Update()
   sunRays.Enabled = sky.CelestialBodiesShown


This. I have used skyboxes with a sun already in it and use the Sunrays effect with CelestialBodiesShown disabled and I believe having this be a possibility is a lot better than having studio (or the game) disable the Sunrays effect automatically.

Because if the sun is hidden, you could just instead disable/remove the sunrays effect yourself and this way it will keep this possibility for those who want this effect. I am sure if this change where to be made, it would anger a lot of people, so just compromise and simply remove the sunrays effect if you are not going to have a sun.

1 Like