Hello, I have been scripting this PauseMenu game system. It’s very simple, Nothing complex. But for some reason it does not work. the output does not give me any errors. Even though all of filters are opened in the output. Do you see an error here?
--Variables
--Gets UI
local StarterGUI = game.StarterGui
local BetaTesterUI = StarterGUI.BetaTesterUI
local AdminPanelUI = StarterGUI["AdminPanelUI(Delayed)"]
local CompassUI = StarterGUI.CompassGui
local GameGUI = StarterGUI.GameGUI
local RadarUI = StarterGUI.RadarGui
local Player = game.Players.LocalPlayer
local player = game.Players
local PlayerService = game:GetService("Players")
local Lightning = game.Lighting
local UIS = game:GetService("UserInputService") --InputService <
-------------------------------------------
--PauseMenu
local PauseMenu = StarterGUI.PauseMenu
local BG = script.Parent.PauseMenuBG
local PauseFrame = script.Parent.PauseMenuBG
local LeaveButton = PauseMenu.PauseMenuBG.PauseFrame.LeaveGame
local ReturnToGameButton = PauseMenu.PauseMenuBG.PauseFrame.ReturnToGame
--Tabs
local SettingButtonTab = PauseMenu.PauseMenuBG.Tabs.TabFrame.Settings
local RankButtonTab = PauseMenu.PauseMenuBG.Tabs.TabFrame.Ranks
local PauseButtonTab = PauseMenu.PauseMenuBG.Tabs.TabFrame.Pause
--LeaveGame Confirmation
local LeaveGameConfirmationFrame = PauseMenu.PauseMenuBG.PauseFrame.LeaveGame.Confirmation
local BackToMainMenuButton = LeaveGameConfirmationFrame.BackToMainMenu
local LeaveGameButton = LeaveGameConfirmationFrame.LeaveGameButton
local function LeaveGame()
LeaveGameButton.MouseButton1Click:Connect(function()
LeaveGameConfirmationFrame.Visible = true
LeaveGame()
end)
end
local function ReturnToGame()
ReturnToGameButton.MouseButton1Click:Connect(function()
PauseFrame.Visible = false
if LeaveGameConfirmationFrame.Visible == true then
LeaveGameConfirmationFrame.Visible = false
--Animation
ReturnToGameButton.MouseEnter:Connect(function()
local ReturnUIStroke = ReturnToGameButton.UIStroke
ReturnUIStroke.Enabled = true
ReturnToGameButton.MouseLeave:Connect(function()
local LeaveReturnUIStroke = ReturnToGameButton.UIStroke
LeaveReturnUIStroke.Enabled = false
ReturnToGame()
end)
end)
end
end)
end
local function PauseMenuLeaveGame()
LeaveButton.MouseButton1Click:Connect(function()
LeaveGameConfirmationFrame.Visible = true
PauseFrame.Visible = false
--Animation
LeaveButton.MouseEnter:Connect(function()
LeaveButton.UIStroke.Enabled = true
LeaveButton.MouseLeave:Connect(function()
LeaveButton.UIStroke.Enabled = false
PauseMenuLeaveGame()
end)
end)
end)
end
--UIS.InputBegan:Connect(function(input,gameProccessedEvent)
--if input.KeyCode == Enum.KeyCode.Tab then
-- local Blur = Instance.new("BlurEffect", Lightning)
-- Blur.Size = 10
--end
--end)
--Connections
You haven’t called the function anywhere…
Also, you have a recursive loop in all of your functions, where you call the function inside the definition of the function… Is this intentional? Perhaps this is why your functions aren’t running…
Yes but you’ve called them inside the functions themselves though, and I’m not sure if that’s what you want. Sometimes this is needed, I’m not sure if this is the case here though.
yes, i forgot to say, you have to connect them to events and call them. Don’t just call them outside of the script, otherwise they’ll run at the start.
`--Variables
--Gets UI
local StarterGUI = game.StarterGui
local BetaTesterUI = StarterGUI.BetaTesterUI
local AdminPanelUI = StarterGUI["AdminPanelUI(Delayed)"]
local CompassUI = StarterGUI.CompassGui
local GameGUI = StarterGUI.GameGUI
local RadarUI = StarterGUI.RadarGui
local Player = game.Players.LocalPlayer
local player = game.Players
local PlayerService = game:GetService("Players")
local Lightning = game.Lighting
local UIS = game:GetService("UserInputService") --InputService <
-------------------------------------------
--PauseMenu
local PauseMenu = StarterGUI.PauseMenu
local BG = script.Parent.PauseMenuBG
local PauseFrame = script.Parent.PauseMenuBG
local LeaveButton = PauseMenu.PauseMenuBG.PauseFrame.LeaveGame
local ReturnToGameButton = PauseMenu.PauseMenuBG.PauseFrame.ReturnToGame
--Tabs
local SettingButtonTab = PauseMenu.PauseMenuBG.Tabs.TabFrame.Settings
local RankButtonTab = PauseMenu.PauseMenuBG.Tabs.TabFrame.Ranks
local PauseButtonTab = PauseMenu.PauseMenuBG.Tabs.TabFrame.Pause
--LeaveGame Confirmation
local LeaveGameConfirmationFrame = PauseMenu.PauseMenuBG.PauseFrame.LeaveGame.Confirmation
local BackToMainMenuButton = LeaveGameConfirmationFrame.BackToMainMenu
local LeaveGameButton = LeaveGameConfirmationFrame.LeaveGameButton
local function LeaveGame()
LeaveGameButton.MouseButton1Click:Connect(function()
LeaveGameConfirmationFrame.Visible = true
end)
end
local function ReturnToGame()
ReturnToGameButton.MouseButton1Click:Connect(function()
PauseFrame.Visible = false
if LeaveGameConfirmationFrame.Visible == true then
LeaveGameConfirmationFrame.Visible = false
--Animation
ReturnToGameButton.MouseEnter:Connect(function()
local ReturnUIStroke = ReturnToGameButton.UIStroke
ReturnUIStroke.Enabled = true
ReturnToGameButton.MouseLeave:Connect(function()
local LeaveReturnUIStroke = ReturnToGameButton.UIStroke
LeaveReturnUIStroke.Enabled = false
end)
end)
end
end)
end
local function PauseMenuLeaveGame()
LeaveButton.MouseButton1Click:Connect(function()
LeaveGameConfirmationFrame.Visible = true
PauseFrame.Visible = false
--Animation
LeaveButton.MouseEnter:Connect(function()
LeaveButton.UIStroke.Enabled = true
LeaveButton.MouseLeave:Connect(function()
LeaveButton.UIStroke.Enabled = false
end)
end)
end)
end
PauseMenuLeaveGame()
ReturnToGame()
LeaveGame()
--UIS.InputBegan:Connect(function(input,gameProccessedEvent)
--if input.KeyCode == Enum.KeyCode.Tab then
-- local Blur = Instance.new("BlurEffect", Lightning)
-- Blur.Size = 10
--end
--end)
UIS.InputBegan:Connect(function(input,gameProccessedEvent)
if input.KeyCode == Enum.KeyCode.Tab then
local Blur = Instance.new("BlurEffect", Lightning)
Blur.Size = 10
PauseMenuLeaveGame()
end
end)