Disable blur isn't working

So I made a script were when you press a textbutton the button will dissapear and the blur will be disabled . But the blur disabling isn’t working . Heres my code :

local textbutton = script.Parent

local text = textbutton.Text

textbutton.MouseButton1Click:Connect(function()

  textbutton.Text = "Loading!"

  wait(2)

  textbutton.Visible = false

  game.Lighting:GetChildren("Blur").Enabled = false

end)

(sorry for the poorly formatted text)

:GetChildren() returns an array (and you’re using it wrong), in this case you’re only searching for an object named Blur.
The right way would be:

game:GetService('Lighting').Blur.Enabled = false

You can also be fancy about it and set its value to the opposite:

game:GetService('Lighting').Blur.Enabled = not game:GetService('Lighting').Blur.Enabled

This will set the current state to the opposite (false to true, vice versa.)

1 Like

Instance:GetChildren() is used to get a table of all the children of the instance, not to get a specific instance. If you would like to get a specific instance based off of its name, use Instance:FindFirstChild(NAME) instead.

Instead of getting children, use :WaitForChild or just state it directly.
GetChildren returns a table of what’s there and not exactly what you want (I believe) so it wouldn’t work here

Uh maybe define the lighting in a local then try to disable it in the function.

local blur = game.Lighting:FindFirstChild("Blur")

This question has been answered & solved.
Also, you are using FindFirstChild() wrong.

And, FindFirstChild() is approx. ~ 20% slower than using the dot operator.
That’s another fact performance-wise for anyone who might read this post in the future.

1 Like