Hello, so currently I’m trying to finalize my UserInterface for a game I’ve been working on and one of the features that has’t to be finished is the return to menu, which can be activated by either double-tapping the “M” key on a laptop/PC or pressing a button on mobile. (Xbox not supported as of right now). Now the base of the function works, however, an issue I’m having is activating the blur effect. I’ve designated two separate functions for this called EnableBlur() and DisableBlur(), however when returning to the menu, it seems like the EnableBlur function just fails to work even though it works on first join.
Here’s the code;
local function DisableBlur()
for i = 1,BlurEffect.Size do
wait(0.1)
BlurEffect.Size = BlurEffect.Size - 1
end
BlurEffect.Enabled = false
return false
end
local function EnableBlur()
BlurEffect.Enabled = true
for i = 1,BlurEffect.Size do
wait(0.1)
BlurEffect.Size = BlurEffect.Size + 1
end
return true
end
local function CloseCurrentTab()
if CurrentTab ~= nil then
CurrentTab:TweenPosition(MenuConfig.Tab_ClosePos,Enum.EasingDirection.Out,Enum.EasingStyle.Linear,MenuConfig.SlideTime,false,function()
CurrentTab:TweenPosition(MenuConfig.Tab_HiddenPos,Enum.EasingDirection.Out,Enum.EasingStyle.Linear,0,false,function()
CurrentTab.Visible = false
return false
end)
end)
end
end
local function EnableMenu()
if MenuEnabled then return false end
local LocalCamera = Workspace:FindFirstChild('Camera')
if not MenuConfig.CameraPart then return false end
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,false)
EnableBlur()
LocalCamera.CameraType = "Scriptable"
LocalCamera.CameraSubject = MenuConfig.CameraPart
LocalCamera.CFrame = MenuConfig.CameraPart.CFrame
MainMenu.Visible = true
MenuEnabled = true
TitleDisplay.Title.Text = MenuConfig.GameTitle
MainMenu:TweenPosition(MenuConfig.RevealedPosition,Enum.EasingDirection.Out,Enum.EasingStyle.Linear,MenuConfig.SlideTime)
end
local function CloseMenu()
CloseCurrentTab()
MainMenu:TweenPosition(UDim2.new(-0.077, 0,0.538, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Linear,0.5,false,function()
MainMenu.Visible = false
MenuEnabled = false
local LocalCamera = Workspace:FindFirstChild('Camera')
LocalCamera.CameraType = "Custom"
LocalCamera.CameraSubject = LocalCharacter.Head
DisableBlur()
BlurEffect.Enabled = false
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,true)
ToggleHUD()
end)
end
Here’s a gif of it;
https://gyazo.com/52dfa08836f7cb8059007111d6e312d6
The gif above shows the menu opening + blur on join, and then the menu opening + blur via double-tapping the “M” key.
Any help trying to solve this issue is much appriecated, thanks!