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

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

Asked by 5 years ago

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

Log in to vote
0
Answered by
Ankur_007 290 Moderation Voter
5 years ago
Edited by User#24403 5 years ago

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: lua 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:

```lua 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.

Ad

Answer this question