Website Style Menu System not Working

I am trying to create a website like menu which when clicked opens a page and closes the other one
i.e. if someone is on the homepage. When they click on the button to take them to the about page, it will first close the homepage then open the about page.

I tried using a script which is using similar function but it did not work

Location of the script (Ignore the bad editing I just used the snip & sketch thingy)
image

The Variables

--Pages--

local Pages = script.Parent.Parent.Parent.MainFrame
local Home = Pages.HomeScreen
local About = Pages.AboutAdminify
local BanManager = Pages.BanManager
local Commands = Pages.ServerCommandsScreen
local Donate = Pages.DonateScreen
local Settings = Pages.SettingsScreen
local PrevPage

--Buttons--

local HomeBTN = script.Parent.HomeButton
local AboutBTN = script.Parent.AboutAdminify
local BanMangerBTN = script.Parent.BanManager
local CommandsBTN = script.Parent.Commands
local DonateBTN = script.Parent.Donate
local SettingsBtn = script.Parent.Settings

The Script

--Home Button--
HomeBTN.MouseButton1Click:Connect(function()
	PrevPage.Visible = false
	wait()
	Home.Visible =true
	PrevPage = Home
	PrevPage.Visible = true
end)

--About Page--
AboutBTN.MouseButton1Click:Connect(function()
	PrevPage.Visible = false
	wait()
	About.Visible =true
	PrevPage = About
	PrevPage.Visible = true
end)

--Ban Manager--
BanMangerBTN.MouseButton1Click:Connect(function()
	PrevPage.Visible = false
	wait()
	BanManager.Visible =true
	PrevPage = BanManager
	PrevPage.Visible = true
end)

*I have purposely put those many variables since I was testing this script. I need all the variables tho

What is the problem? Does it work, but incorrectly, or does nothing happen at all? Do you get any errors?

1 Like

Nothing happens at all, I could not check what errors since everytime I use it on studio, it crashes, i had to use the roblox app