I the blur stays under camera and doesn’t get destroyed. The gui turns invisible though.
function onClick()
local blur = Instance.new('BlurEffect')
blur.Parent = workspace.CurrentCamera
local shopFrame = script.Parent.Parent.ShopScreen
if shopFrame.Visible == false then
shopFrame.Visible = true
blur.Enabled = true
else
shopFrame.Visible = false
blur.Enabled = false
end
end
script.Parent.MouseButton1Down:Connect(onClick)
This is inside of a localscript. No errors are appearing in the output. I appreciate any and all help with this . If you need anymore information, just ask.
Hi there Mithrandir, according to your script, you are never attempting to destroy the blur, simply disable it. Also, a better solution would be as follows: local blur = workspace.CurrentCamera:FindFirstChildOfClass("BlurEffect") or Instance.new("BlurEffect")
This should make your code functional, as currently, you’re creating a new blur each and every time and the conditional statement (if) below disables the new blur you just created if the Shop Frame is hidden, and leaves a non-referenced blur in the camera if it’s visible.
The problem is that you are creating a blur inside your function. So every time, a new blur effect instance is being created, so the old blur is not being disabled.
So, to fix your script remove and place the code I just quoted outside of the function.