I have no idea why this wont work. Im not getting any errors in the output, but its not working :(

game.Players.PlayerAdded:connect(function(player)
	local intro = player.PlayerGui:WaitForChild("Intro")
	local XPgui = player.PlayerGui:WaitForChild("XpBar").Frame
	
	while true do
		wait(0.1)
		if intro then
			XPgui.Visible = false
		else
			XPgui.Visible = true
			wait(0.1)
			script.Parent.GuiVisibleAfterIntro:Destroy()
		end
	end
end)