Changing camera type resets blur

Hello forum. I am having issues with creating a blur. When the blur is first created, the size is what I want it to be. But when the camera type is switched, it automatically sets to 15 and can’t be changed.

Here is the code

local plr = game.Players.LocalPlayer
local cam = workspace:WaitForChild("Camera")
game.SoundService.bgmusic.Playing = true
local mouse = plr:GetMouse()
local blur = Instance.new("BlurEffect")
blur.Parent = cam
blur.Enabled = true
blur.Size = 5

	local currentCamera = cam
	repeat
		task.wait() 
	until currentCamera.CameraType ~= Enum.CameraType.Fixed
	currentCamera.CameraType = Enum.CameraType.Scriptable

plr.PlayerGui.Menu.Enabled = true
cam.CFrame  = workspace:WaitForChild('CamPart').CFrame
local camPart = workspace.CamPart

local con
local maxTilt = 5
con = game:GetService("RunService").RenderStepped:Connect(function()
	
	if plr.PlayerGui.Menu.Enabled == false then con:Disconnect() cam.CameraType = Enum.CameraType.Custom blur:Destroy();  
		local tween = game:GetService("TweenService"):Create(game.SoundService.bgmusic, TweenInfo.new(5), {Volume = 0})
		tween:Play()
		return end
	blur.Size = 15
	cam.CFrame = camPart.CFrame * CFrame.Angles(
		math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
		math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),
		0
	)
end)

All help is appreciated and thank you.

Parent the BlurEffect to Lighting instead of the camera

I had already tried that before and it didnt woek

try reinitialising the cam variable whenever you change the CameraType
I think when the camera type is changed Roblox creates a new instance of the Camera

currentCamera.CameraType = Enum.CameraType.Scriptable
cam = workspace.CurrentCamera

also you should use a BindableEvent instead of a constant loop if this is being communicated through client to client
using loops like this can very performance intensive