Making the bloom intensity change with a script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    When you press a button, the bloom intensity will change.
  2. What is the issue? Include screenshots / videos if possible!
    The bloom intensity isn’t changing.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I haven’t found any solutions yet. Code down below. :slight_smile:
local BloomIntensity = game.Lighting.Bloom.Intensity
local BloomIntensityOff = script.Parent.Bloom.BloomOff
local BloomIntensityLow = script.Parent.Bloom.BloomLow
local BloomIntensityMedium = script.Parent.Bloom.BloomMedium
local BloomIntensityHigh = script.Parent.Bloom.BloomHigh

BloomIntensityOff.MouseButton1Click:Connect(function()
	BloomIntensity = 0
end)

BloomIntensityLow.MouseButton1Click:Connect(function()
	BloomIntensity = .3
end)

BloomIntensityMedium.MouseButton1Click:Connect(function()
	BloomIntensity = .6
end)

BloomIntensityHigh.MouseButton1Click:Connect(function()
	BloomIntensity = 1
end)

When you are declaring the variable “BloomIntensity” you are setting it to the value, not the instance

instead do

local BloomIntensity = game.Lighting.Bloom

BloomIntensity.Intensity = 1

This is because when you create the variable BloomIntensity, all it does is save the number. For example, if it was saved as 1, the variable would be 1.

You can fix this by saving the actual bloom in the variable instead.

Fixed code:

local Bloom = game.Lighting.Bloom
local BloomIntensityOff = script.Parent.Bloom.BloomOff
local BloomIntensityLow = script.Parent.Bloom.BloomLow
local BloomIntensityMedium = script.Parent.Bloom.BloomMedium
local BloomIntensityHigh = script.Parent.Bloom.BloomHigh

BloomIntensityOff.MouseButton1Click:Connect(function()
	BloomIntensity = 0
end)

BloomIntensityLow.MouseButton1Click:Connect(function()
	Bloom.Intensity = .3
end)

BloomIntensityMedium.MouseButton1Click:Connect(function()
	Bloom.Intensity = .6
end)

BloomIntensityHigh.MouseButton1Click:Connect(function()
	Bloom.Intensity = 1
end)

Thx u so much! It worked! Thx. (adding characters)

1 Like