Blur problem script

So I’m trying to fade in a blur but its not working how could I do this btw it also fades back, well I’m trying to do that.

this is my script, but its not working:

local tweenService = game:GetService("TweenService")
local gameMode = game:WaitForChild("ReplicatedStorage"):WaitForChild("GameModeValue")
local blur = game:GetService("Lighting"):WaitForChild("Blur")

gameMode:GetPropertyChangedSignal("Value"):Connect(function()
	local info = TweenInfo.new(
		8,
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.In,
		0,
		true,
		0
	)
	
	local Goals =
	{
			Size = 15
	}
	
	local BlurTween = tweenService:Create(blur, info, Goals)
	BlurTween:Play()
	
end)

The problem here is with the goals. When you have the goals as a separate table, you can’t have elements directly inside it.

-- What you have
local Goals =
{
  Size = 15
}
-- What you need
local Goals = {}
Goals.Size = 15

The blur should fade out again since you have reversing set to true in your TweenInfo. Also, I’d advise that you just create the tween once outside of the connection and then play it when the value changes, since right now you aren’t deleting your tweens so they will build up over time.

I think you need to set the tween repeat to one

@ShockingBulletin
Nope, you are not correct with the problem. The table he created is good. If you try what he did and print it out, it will still come out as a table. Also, the tween should automatically get garbage collected once the whole block is done. It will no longer be held in the memory. I mean sure the script will create the Tween again, but it will also just get garbage collected.

@wastbo In the documentation, the default value of RepeatCount for the TweenInfo is 0, which means “Do not repeat”. If it was set one 1, it will like “Repeat once”.

@OP The only thing that may cause this to not work is that the Value property of the gameMode is not changing, thus it is not firing the event.