Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local lighting = game:GetService("Lighting")
- local blur = lighting:FindFirstChildOfClass("BlurEffect")
- local blurSize -- variable to store the default blur value
- local open = false -- variable to store whether the GUI is open or not
- local function setup()
- if(blur) then
- blurSize = blur.Size -- store the default blur value if instance "Blur" already exists
- else
- blur = Instance.new("BlurEffect")
- blur.Parent = lighting
- blur.Size = 0
- end
- end
- local function openUI()
- blur.Size = 15 -- Any value of your choice, I'm using 15
- open = true
- end
- local function closeUI()
- if(blurSize) then -- if we have a default blur value
- blur.Size = blurSize
- else
- blur.Size = 0 -- we keep the blur effect, but give it size 0
- end
- open = false
- end
- setup() -- we run the setup function to store the default value, and whatever else you want;
- --[[
- Usage example:
- button.MouseButton1Click:Connect(function()
- if(open) then
- closeUI()
- else
- openUI()
- end
- end)
- ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement