Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i add a blur effect when the menu is visible for the local player?

This one is the local script under the blur in lightning

local blur = script.Parent

local frame = game.StarterGui.MenuGui.ScrollingFrame

frame.Visible = false

if frame.Visible == true then

blur.Size = 24

else

if frame.Visible == false then

blur.Size = 0

end

end

1 answer

To add a blur effect when a menu is visible for someone or any cause for that matter, you must first understand that this change must be made on the client so that said change isn't made for all players at once. Looks like you have the concept down in your script, just a matter of accessing the instances the right way.

The Problem

The line:

local frame = game.StarterGui.MenuGui.ScrollingFrame

is wrong. game.StarterGui contains the UI at its initial state and isn't the UI that the player sees or changes. The actual UI is copied from game.StarterGui and put into the player's PlayerGui. So, to fix your script you can use this:

local blur = script.Parent
local player = game:GetService("Players").LocalPlayer -- Returns the player instance of the client the script is running on (LOCALSCRIPTS ONLY)
local frame = player.PlayerGui:WaitForChild("MenuGui", 10):WaitForChild("ScrollingFrame", 10)
frame.Visible = false

-- Make the blur update when the frame changes
frame:GetPropertyChangedSignal("Visible"):Connect(function()
	blur.Size = frame.Visible and 24 or 0
	end
end)

Useful links and articles:


Please comment if you have any questions or I have made a mistake.

This discussion is preserved as it was. New answers, comments, and votes are closed.