Bloom Turns off/on at a specific time of day?

local bloom = game.Lighting.BloomEffectHere

local disabletime = 1

local enabletime = 1 -- Change this value

game.Lighting:GetPropertyChanged("ClockTime"):Connect(function()
	if game.Lighting.ClockTime == disabletime then
		bloom.Enabled = false
	end
	if game.Lighting.ClockTime == enabletime then
		bloom.Enabled = true
	end	
end)

Meant to reply to @LuckyLion1378 lol

This is a lot longer than it needs to be. It should be just this:

local bloom = game.Lighting.BloomEffectHere

local disabletime = 1

local enabletime = 1 -- Change this value

game.GetPropertyChangedSignal("ClockTime"):Connect(function()
	if game.Lighting.ClockTime == disabletime then
		bloom.Enabled = false
	end
	if game.Lighting.ClockTime == enabletime then
		bloom.Enabled = true
	end	
end)

Assuming that disabletime and enabletime have the same time representation of TimeOfDay and ClockTime (respectively), this implementation introduces redundancy as TimeOfDay and ClockTime are essentially synced.

Furthermore, @WooleyWool provides a more simplified version above.

1 Like

now im getting awfully confused, do i need to do it in like roblox player? is there a difference? nothing seems to be working and i feel like its some silly small mistake like all the other mistakes i make in developing

No, put the script I added into a server/local script in either serverscriptservice or startergui respectively.

well that explains it, i was told to put it in a normal script, and not a localscript

Itā€™s better to put it into a local script as you want the visuals to happen on the client, not on the server.

alright let me try this out and let you know, iā€™ve got high hopes!

although the idea of the localscript is a good idea, the only thing it did was lag out the game and not add bloom :confused:

It shouldnā€™t be doing that, are there any other scripts that are manipulating the Lighting?

no i dont think so, although i have multiple different (Disabled and differently named) blooms for different times and settings, for screenshots.

So does the script work? It may just be your deviceā€¦?

im not getting anything in output or any script errors, i dunno why it wouldnt work. its a great script and everything else is good so im completely confused here

should the said bloom that the script is manipulating be enabled or disabled?

Try playtesting your game and set the clocktime value in the properties tab to whatever enabled/disabled clocktime is. If itā€™s enabled, then it works.

roger that, ill try that right now since im already playtesting

I tested this, andā€¦

GetPropertyChanged is not a valid member of Lighting "Lighting"

I tried it with client and server

When i move the ClockTime Slider in the properties of lighting it does not actually change the time or anything in the game window, but rather just changes the number in it and pretends like it changed the time.

local bloom = game.Lighting.BloomEffectHere

local disabletime = 1

local enabletime = 1 -- Change this value

game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
	if game.Lighting.ClockTime == disabletime then
		bloom.Enabled = false
	end
	if game.Lighting.ClockTime == enabletime then
		bloom.Enabled = true
	end	
end)

Try GetPropertyChangedSignal()

What code are you using to change the time of day? Since weā€™re only checking if the time is exactly disabletime/enabletime, maybe the time of day is changing so much that it goes OVER it, not exactly it.