BlurEffect problem

Hi guys! I have a problem… So… I made a main menu, with BlurEffect, and camera manipulating. BUT! I have a problem, when the player dies, the Blur Effect shows up again… I checked the Menu’s screengui settings, the “ResetOnSpawn = false”… How can I fix this?

Here is the code:

local playButton = script.Parent.Ui.MainFrame.playButton
local mainFrame = script.Parent.Ui.MainFrame
local openButton = script.Parent.MainGui.openButton
local title = script.Parent.Ui.MainFrame.Title
local hp = script.Parent.nGUI.Health
local moneyGUI = script.Parent.nGUI.Coins
local attentionGUI = script.Parent.Ui.atFrame
local beta = script.Parent.Ui.betaLabel

--MainCameraSettings--
local player = game.Players.LocalPlayer
local character = player.Character
local camera = workspace.CurrentCamera 

repeat wait()
	camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable

camera.CFrame = workspace.CameraPos.CFrame 
local blur = Instance.new("BlurEffect",camera)

playButton.MouseButton1Click:Connect(function()
	workspace.CurrentCamera.Blur.Enabled = false
	workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
	title.Visible = false
	openButton.Visible = true
	playButton.Visible = false
	mainFrame.Visible = false
	hp.Visible = true
	moneyGUI.Visible = true
	attentionGUI.Visible = true
	beta.Visible = true
end)

I tried to disable it, but nothing… :confused:

Since you defined blur already you can just use it instead of workspace.CurrentCamera…
Also if it still doesnt work after changing the Enabled State, either delete the blur completely or set the Size to 0. BlurEffect Article

1 Like

You’d have to disable the “ResetOnSpawn” property of the ScreenGui. The reason why this is happening is because the ScreenGui is getting destroyed every time the player dies and the ScreenGui is cloning back to the player on respawn, causing the script to run again.

Also, a quick tip: Use

game:GetService("Players")

Instead of

game.Players
1 Like

Here, this should work.
https://pastebin.com/raw/Q5EKqPGi

Let me know if it doesn’t.