Multi-page GUI function not working

Hello! I am working on my first ever multi-page GUI and I have created a function that determines what page has been selected and in theory should enable that frame while disabling all of the other ones.

local function displayPage(requestedPage)
	
	for i, page in pairs(masterFrame:GetChildren()) do
		if page:IsA("Frame") then
			if page.Name == requestedPage.Name then
				print("Selected page found")
				print(requestedPage.Name)
				page.Visible = true
			else
				page.Visible = false
			end

		end
	end
end

Note: This function is sending this information:

displayPage(masterFrame.InLobbyFrame)

The function seems to work fine as it can detect which page I selected but will not make that page visible while making the other ones invisible. Here is the page that I want to display:


There is a, “create lobby” button on the first page that should then send you to this new one after it is created:


I don’t exactly know what I’m getting wrong here, seems like it should be something small but I’ve been looking at it for a bit now and can’t really find out the solution.

1 Like

are the other pages a Frame? it looks like they might be a ScrollingFrame.

try replacing

page:IsA("Frame")

with

page:IsA("GuiObject")