Blur Fade after period of time

I want to make it so after a certain amount of seconds the blur effect fades off. I achieved this but it’s not really smooth per say.

How would I go about making the blur tween so it looks smoother instead of setting its transparency every 0.1 seconds.

wait(10)
game.Lighting.Blur.Size = 15
wait(0.1)
game.Lighting.Blur.Size = 14
wait(0.1)
game.Lighting.Blur.Size = 13
wait(0.1)
game.Lighting.Blur.Size = 12
wait(0.1)
game.Lighting.Blur.Size = 11
wait(0.1)
game.Lighting.Blur.Size = 10
wait(0.1)
game.Lighting.Blur.Size = 9
wait(0.1)
game.Lighting.Blur.Size = 8
wait(0.1)
game.Lighting.Blur.Size = 7
wait(0.1)
game.Lighting.Blur.Size = 6
wait(0.1)
game.Lighting.Blur.Size = 5
wait(0.1)
game.Lighting.Blur.Size = 4
wait(0.1)
game.Lighting.Blur.Size = 3
wait(0.1)
game.Lighting.Blur.Size = 2
wait(0.1)
game.Lighting.Blur.Size = 1
wait(0.1)
game.Lighting.Blur.Size = 0

Yes it looks horrible but I couldn’t find any post specifically explaining this topic and I’ve tried making one with tweening but it didn’t work, if you can help let me know! thanks.

1 Like

you need to use tween service to easy . :slight_smile:

You could use TweenService for this, but isn’t really necessary. I would opt to use a for loop if you’re just going to add 1 to the blur’s size.

local Lighting = game:GetService("Lighting")

for i = 0, 15 do
	task.wait(.01)
	Lighting.Blur.Size = i
end
TweenService:Create(
    game:GetService("Lighting").Blur,
    TweenInfo.new(5),
    {Size = 0}
):Play()

where would I put this, I tried workspace and startergui

local tweenService = game:GetService("TweenService")
local lighting = game:GetService("Lighting")
local blurTween = tweenService:Create(lighting:WaitForChild("Blur"), TweenInfo.new(1.5, Enum.EasingStyle.Sine), {Size = 0})

blurTween:Play()
1 Like

Replace

With the code I sent. Remember to declare the TweenService variable!

1 Like