Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I blur the game background when I press Escape key?

Asked by 6 years ago
Edited 6 years ago

Hello, I'm a beginner scripter on ROBLOX!

I need help with something I've trying a few days ago. When you press the key "ESC" (or escape) on your keyboard it blur the background of your game.

And the same if you close the "ESC" (or escape) menu, it remove the blur of the game with the element "BlurEffect".

local GuiService = game:GetService("GuiService")

GuiService.MenuOpened(function()
    print("Menu opened")
    game.Lighting.Blur.Enabled = true
end)

GuiService.MenuOpened(function()
    print("Menu closed")
    game.Lighting.Blur.Enabled = false
end)

When I try this code, it doesn't work.

I read those, I don't found a example for them: http://wiki.roblox.com/index.php?title=API:Class/GuiService/MenuOpened http://wiki.roblox.com/index.php?title=API:Class/GuiService/MenuClosed

And: http://wiki.roblox.com/index.php?title=API:Class/GuiService

2 answers

Log in to vote
0
Answered by 6 years ago

Hi...?

0
First: Use tehe "insert lua script" When your adding a script, I dont even understand what the script is saying, second, There is no "blur" property on the lighting, And third, The community of scriptinghelpers is just a few persons, So answers may take from simply 3 minutes to 3 hours. Chris75764 49 — 6y
0
Aww, sorry it's my first time on Scripting Helpers. In details, "BlurEffect" in Lighting. The script see if someone has pressed Escape key, so it blurs out the game background in the menu. That's what I mean, and when someone close the menu it change Enabled to false from BlurEffect. But looks like it doesn't work. User#21483 0 — 6y
0
Try checking the script lines now, you may understand what I want to do. User#21483 0 — 6y
0
Aw sowwy owo uwu i will do mwor thwings like thwese GIassWindows 141 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Assuming you’re using a localscript since you have to anyways, you could try to put the BlurEffect in the camera in Workspace instead. The blur will still show if you do that and it’ll let you do it locally (Only the player that opened menu will see it). Then just edit your code to toggle the blur in the camera.

Oh wait, there are also some minor problems with your script so here’s a fixed version :

local GuiService = game:GetService("GuiService")

GuiService.MenuOpened:Connect(function()
    print("Menu opened")
    game.Workspace.Camera.Blur.Enabled = true
end)

GuiService.MenuOpened:Connect(function()
    print("Menu closed")
    game.Workspace.Camera.Blur.Enabled = false
end)

You forgot to add :Connect on the functions, and I changed the script so it’ll toggle the blur in the camera instead. Also make sure the blur is named “Blur”.

Hoped this helped!

Also users like you still exist? I thought Scripting Helpers removed them or something.

0
I have a updated script for 2020 : 01 local GuiService = game:GetService("GuiService") 02 03 GuiService.MenuOpened:Connect(function() 04 print("Menu opened") 05 game.Workspace.Camera.Blur.Enabled = true 06 end) 07 08 GuiService.MenuOpened:Connect(function() 09 print("Menu closed") 10 game.Workspace.Camera.Blur.Enabled = false 11 end) VanceGamer2009 13 — 4y

Answer this question