Blur on/off button script

Hey Devs,

So i would like to have Blur on/off button in my experience, but I’m struggling in scripting it. I’m pretty sure It is easy script, i just can’t get it together. (Also stupid me deleted the script, i wanted to try something and forgot to copy.)

Can anyone please help me?

I would be thankful for any comments!

Have a great day!
-jeziskrista

2 Likes

It is in fact very easy to script.

local button = script.Parent -- Replace with your button's directory
local blur = game.Lighting:WaitForChild("Blur") -- Make sure to have a blur object in Lighting

button.Activated:Connect(function()
	blur.Enabled = not blur.Enabled
end)

This script should work for mobile and PC users and just switches the Enabled property on the blur to the opposite of the current boolean.

3 Likes

Hey!

The script is working perfectly! Thanks!

Just another question, Is there any possibility that you could add the part of script when you click the button the text changes from “Blur Off” to “Blur on”?

It would help me a lot!

1 Like

Here is the updated script:

local button = script.Parent -- Replace with your button's directory
local blur = game.Lighting:WaitForChild("Blur") -- Make sure to have a blur object in Lighting

button.Activated:Connect(function()
	blur.Enabled = not blur.Enabled

	if blur.Enabled then
		button.Text = "Blur on"
	else
		button.Text = "Blur off"
	end
end)

Wasn’t sure if you wanted the button to state what the blur’s current state was or what it would be after you pressed the button. I just scripted it so it shows the current state, if you want it to show the state after you pressed it just swap around the text.

EDIT: When you first launch the game it will be the text already there. Just manually edit the text in studio to what you want.

3 Likes

Alright, Thank you so much! This helped me a lot! I’m really thankful!

2 Likes

One last thing, I’m trying to make the button appear after the game intro is done playing, and I already have one working button, and that appears after the intro, so i tried taking the script which was used, and changing it to proper naming but now it somehow doesnt work?

It would make me really happy if you could take a look.

Original Additional lanes of script that was implemented into the intro script (Working one):

local player = game.Players.LocalPlayer
local SoundGui = player:WaitForChild("PlayerGui"):WaitForChild("SoundGui")

SoundGui.Enabled = true

The Updated one (Not working):

local player = game.Players.LocalPlayer
local BlurGui = player:WaitForChild("PlayerGui"):WaitForChild("BlurGui")

BlurGui.Enabled = true

Topic where people helped: How can i make GUI button appear after 8 seconds?

Again, it would really help me.

Thanks in advance,
-jeziskrista

1 Like

I don’t see why it wouldn’t work. I can’t see any errors that you have made. Could I get a screenshot/video of it?

I made a model of your GUI’s and I scripted the buttons to appear after 8 seconds and it worked just fine for me. Here is what mine looks like:

image

local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local soundGui = playerGui:WaitForChild("SoundGui")
local blurGui = playerGui:WaitForChild("BlurGui")

soundGui.Enabled = false
blurGui.Enabled = false
task.wait(8)
soundGui.Enabled = true
blurGui.Enabled = true

EDIT: I combined the enabling of the blurGui and the soundGui in the local script highlighted in blue in my screenshot.

2 Likes

Sure, i will make quick video, give me a minute.

1 Like

Video: Screen Recording 2025-03-04 at 21.36.40.mov - Google Drive

1 Like

Could you open the output window so I can see if an error comes up when you play test your game? Go to view then click on output to open it. Send a screenshot of the entire output window please as this would really help because I am stumped to why it would do this.

image

2 Likes

Sure thing. Give me minute. be right back

1 Like

1 Like

Let me delete the truck for now, it spams error codes all the time

1 Like

Are you hiding the blur GUI at the start of the script, as I think you are hiding the music GUI at the start looking at the other post. You are putting the .Enabled = true lines of code at the end of your tweens so I believe they are going to appear at the very end.

If this doesn’t work, I think you should create a new post about this problem so others could help you too. I’ve got no idea what is causing this problem but if I find a possible solution I will let you know in the new post.

2 Likes

Let me check this really quick.

1 Like

Seems like i will create new topic i guess. Thanks for trying to help tho!

2 Likes

Wait, I’m SO STUPID. I just rode the whole topic again, (The one with Music Button) and realized I’ve never actually putted Visibility false at the start of the intro script.

Thanks for still helping me!

1 Like

I said that in my last reply but maybe I made my wording a bit too confusing. Oh well, hopefully your problem is fixed now and no problem! :crossed_fingers::rofl:

2 Likes

it is fixed! Sorry for any inconvenience i made :sweat_smile: :grinning:

2 Likes