Hi all,
I have a local script which sets the bloom value to 5 then it should gradually decrease back to 0. The problem is, it decreases to 0 very quickly and when I try to reduce the speed of it, the script breaks:
game.ReplicatedStorage:WaitForChild("FlashEvent").OnClientEvent:connect(function()
print ("worked")
local bloom = Instance.new("BloomEffect",nil)
bloom.Intensity = 5
bloom.Threshold = 0
bloom.Parent = game.Lighting
for i = 1,bloom.Intensity do
bloom.Intensity = bloom.Intensity-1
wait(1/10)
end
end)
Instead of reducing bloom.Intensity by 1 each time I want to decrease it by .1
But when I tried that, the bloom.Intentsity just gets stuck at 4.5.
I also want this effect to last for a total of 5 seconds, how can I fix this script to do it?

2 comments
Thank you so much for this answer! There were a few other scripts I also created to gradually increase/ decrease a value. But they all had float points. With this, the issue is now rectified!
I'm glad I could help c: